This service allows sftp connections only

This is because the user only opened with sftp, ssh banned

This machine can be landed by other hosts ssh 

app@home:/iot>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:/iot>sftp mysftp@192.168.0.1 ##成功

This is because the / etc / ssh / sshd_config file server side settings, it is necessary to:

AllowTcpForwarding should be set to yes before.

If not set to yes, then the user can only access through a specified directory sftp, ssh and can not log in.

Only AllowTcpForwarding no change AllowTcpForwarding yes, users can log in via ssh and then access the directory.

Meanwhile ForceCommand internal-sftp also commented 

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

 

Then restart the service (roo user service sshd restart), was successful and try again

app@home:/iot>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

 

Guess you like

Origin www.cnblogs.com/pu20065226/p/10962906.html