This service allows sftp connections only


这是因为该用用户只开通了sftp,ssh被禁了

可以通过别的主机ssh登陆这台机器 

app@home:/software>ssh mysftp@192.168.0.1
 Authorized only. All activity will be monitored and reported 
mysftp@192.168.0.1's password: 
This service allows sftp connections only.
Connection to 192.168.0.1 closed.
app@home:/software>sftp mysftp@192.168.0.1 ##成功

这是因为在server端设置的/etc/ssh/sshd_config文件中,需要设置为:

AllowTcpForwarding 应该设置为yes才可。

如果没有设置为yes的话,用户就只能通过sftp访问指定目录,而且不能进行ssh登录.

只有把 AllowTcpForwarding no 改为 AllowTcpForwarding yes ,用户才能通过ssh登录然后访问目录。

同时ForceCommand internal-sftp也要注释掉 

#ChrootDirectory /software/sftp
#ForceCommand internal-sftp
##AllowTcpForwarding no
AllowTcpForwarding yes

 

然后重启服务(roo用户 service sshd restart),重新再试就成功了

app@home:/software>ssh mysftp@192.168.0.1
 Authorized only. All activity will be monitored and reported 
mysftp@192.168.0.1's password: 
Last login: Sun Jun  2 14:22:00 2019 from 192.168.102.82
mysftp@remoteServer:/home/ap/mysftp>ll

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM