0

I'm trying to setup SFTP on my ubuntu server and I'm encountering a problem. When I set up a group in sshd_config file to chroot people to their home directories the user in the group cannot access the server via SSH and this error comes up "software caused connection abort" and sometimes "No directory found".

I'm pretty sure it is to do with permissions but I'm not sure what. I've disabled the UFW for testing so it isn't that. Any help would be gratefully appreciated. Thanks.

Here's what I added to the sshd_config file:

Match Group webadmins
    ChrootDirectory %h
    X11Forwarding no
    AllowTopForwarding no

I left these bottom two commented as I'm just concerned about the ChrootDirectory.

0

If you're chrooting the users, you should either use ForceCommand internal-sftp or set up a shell (along with everything it needs) in each home directory. If neither of these was done, SSH won't be able to login the user.

  • I had previously had ForceCommand internal-sftp in there but I removed it for testing. Even when it's in I can only connect via SSH if I remove myself from the group "webadmins". What do you mean by setup a shell in each home directory? – Philip Crocker Apr 17 '15 at 15:44
  • @PhilipCrocker if you're in webadmins, you will only be able to use SFTP. As for setting up a shell, something like askubuntu.com/questions/93411/simple-easy-way-to-jail-users. – muru Apr 17 '15 at 15:46
  • @ muru What would you suggest doing if I wanted to use SSH and SFTP and restrict users to their home directory? – Philip Crocker Apr 17 '15 at 15:49
  • @PhilipCrocker the linked post on jaling users, I suppose. If you just want to make an excpetion for yourself, that can be done easily: Match Group webadmins User *,!<your-username> should do exclude you from that match block. – muru Apr 17 '15 at 15:53
  • 1
    Why did you use the astrisk and comma? – Philip Crocker Apr 17 '15 at 16:14
0

The directory you are chrooting (in your case %h) should be owned by user root. Use command sudo chown root.root %h

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.