[How to Solve] This service allows sftp connections only

This is because the user has only opened SFTP and SSH has been banned

You can login to this machine through SSH of other hosts

app@home:/software>ssh [email protected]
 Authorized only. All activity will be monitored and reported 
[email protected]'s password: 
This service allows sftp connections only.
Connection to 192.168.0.1 closed.
app@home:/software>sftp [email protected] ##success

This is because/etc/SSH/sshd is set on the server side_ In the config file, it needs to be set to:

Allowtcpforwarding should be set to yes

If it is not set to yes, users can only access the specified directory through SFTP, and can’t log in through SSH

Only by changing allowtcpforwarding no to allowtcpforwarding yes can users log in through SSH and then access the directory

At the same time, forcecommand internal SFTP should also be commented out

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

Then restart the service (roo user service sshd restart), and try again to succeed

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

Similar Posts: