0

I'm using Ubuntu 18.04 and today I installed sftp server using openssh for my server. I followed the instructions on the internet, everything is good, they said I have to add this codes to sshd_config file:

Match group sftp
    ChrootDirectory /home
    X11Forwarding no
    AllowTcpForwarding no
    ForceCommand internal-sftp
    PubkeyAuthentication yes

I did it and the sever can't connect with error from filezilla :"The software cause connection abort. Could not connect to server". Tried in another computer with another version of filezilla and the result is same. But, when I added that code into file ssh_config and deleted from sshd_config. The connection was work perfectly. Anyone here know why?

0

First of all make sure that /home is accessible by sftp group (because by default it isn't).

If the sftp group doesn't work, make sure you're actually logging in with a key, you can first confirm it by using ssh from the terminal (or putty on windows) ssh -vvv login@hostname.com

by default, as long as you're not using root account, you should be able to login without any issues.

the most interesting keys for basic setup are usually: - PubkeyAuthentication to be able to login with keys (also needs UsePAM yes) - PermitRootLogin if you want to login with root account - PasswordAuthentication to allow/disallow using password auth

6
  • Hi. I added group and also added user to that group. I give the permission to home folder based on this code $ sudo chmod 700 /home/sftpuser/ maybe in my file doesn't have UsePAM yes right? – WillRock Mar 4 '19 at 8:36
  • if the sftpuser is normal system user, UsePAM yes is necessary for it to work. make sure the user has correctly set home dir in /etc/passwd. Fix the ChrootDirectory to use username in the path: ChrootDirectory /home/%u – Jan Myszkier Mar 4 '19 at 9:05
  • I added password for sftpuser and I would like to make connecting using password, so should I add PubkeyAuthentication yes usePAM yes PasswordAuthentication yes to sshd_config ? – WillRock Mar 4 '19 at 9:42
  • yes, but fix the ChrootDirectory, too. JUST /home is not ok – Jan Myszkier Mar 4 '19 at 11:06
  • Good news, I found the problem, the problem is chrootDirectory /home. My sftp user is "bloom-sftp", if I edit that code like this chroorDirectory /home/bloom-sftp it will crash connection, but if I write only /home it work. Look like the folder bloom-sftp have not root permission right? I have already type this command sudo chmod 700 /home/bloom-sftp/ – WillRock Mar 5 '19 at 3:18

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.