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
相關文章
相關標籤/搜索