I have two Linux machines. One of them must be a sftp server. I added the following lines to /etc/ssh/sshd_config file:

#SFTP server configuration                                                 
Match Group root                                                           
        ChrootDirectory /share                                               
        ForceCommand internal-sftp

So now I can put and get files over sftp, but when I try to connect with my sftp server over ssh I get the following error:

This service allows sftp connections only.

What should I do to enable both sftp and ssh to root?

Thank you in advance for any help.

1 Answer 1


Allow root to access the remote system? You really do not want to do that. There should however, be a setting in /etc/ssh/sshd_config:

# PermitRootLogin yes|no

It's all in the man page.

  • I have this option set to yes and uncommented.
    – user6758
    Jul 25, 2021 at 12:20
  • And did you restart sshd?
    – Bib
    Jul 25, 2021 at 12:22
  • I didn't change this line. Maybe I was a bit unclear in my question. I've lost possibility to log via ssh when I configured sftp server. When I add my sftp server configuration in /etc/ssh/sshd_config I can use sftp but not ssh. When I comment out these configuration I can use ssh again.
    – user6758
    Jul 25, 2021 at 12:26
  • Then undo the above and see if ssh works again, then debug from there.
    – Bib
    Jul 25, 2021 at 12:28
  • 1
    The ForceCommand internal-sftp option will force sftp and prevent all ssh connections on any user in the group root. You have to look at doing it another way.
    – Bib
    Jul 25, 2021 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.