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