This service allows sftp connections only

这是由于该用用户只开通了sftp,ssh被禁了app

能够经过别的主机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文件中,须要设置为:spa

AllowTcpForwarding 应该设置为yes才可。rest

若是没有设置为yes的话,用户就只能经过sftp访问指定目录,并且不能进行ssh登陆.code

只有把 AllowTcpForwarding no 改成 AllowTcpForwarding yes ,用户才能经过ssh登陆而后访问目录。server

同时ForceCommand internal-sftp也要注释掉 blog

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

 

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

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
相关文章
相关标签/搜索