I have an Ubuntu server running 10.04.6 LTS. It is providing web services. I have setup sftp and given permission to an 'sftp' group to login but have set their root directory to be /var/www/html. They are able to connect to the server but cannot write to the folder. I use setfacl to give the group write permission. If they are already logged in, they can now create folders and files. However, once they logout, they can no longer login. If I remove the acl, the condition reverses again. It is not limited to acls though. I even tried just giving 'other' write-access. Same thing happened.
sshd_config snippet:
Match group sftp
ChrootDirectory /var/www/html
X11Forwarding no
ForceCOmmand internal-sftp
Error when trying to write:
Permission denied.
Error code: 3
Error message from server: Permission denied
Error when trying to login (from session log):
! 2019-12-11 08:23:42.538 Using username "ddinkin".
. 2019-12-11 08:23:42.569 Server offered these authentication methods: publickey,password
. 2019-12-11 08:23:42.569 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2019-12-11 08:23:44.955 Sent password
. 2019-12-11 08:23:44.963 Access granted
. 2019-12-11 08:23:44.963 Opening session as main channel
. 2019-12-11 08:23:45.127 Network error: Software caused connection abort
* 2019-12-11 08:23:45.181 (EFatal) Network error: Software caused connection abort
* 2019-12-11 08:23:45.181 Authentication log (see session log for details):
* 2019-12-11 08:23:45.182 Using username "ddinkin".
* 2019-12-11 08:23:45.182
* 2019-12-11 08:23:45.182 Authentication failed.
What am I missing? I am not a linux guru so please be gentle. I even asked some local SMEs and they don't know either.
Thanks,
Dan
Most ways produce massive complexities, as very few sftp servers work as expected (simple + zero config + chroot logins).
https://www.experts-exchange.com/questions/29133071/Safe-and-productive-ownership-settings-for-a-Wordpress-installation.html provides one approach to using SFTP with HTTPS, so file ownership works with both.
Tip: Ensure you can install setfacl first + verify setfacl actually works (requires a modern OS with acl option set on mount point of file system).
It will be near impossible to produce a secure system without setfacl working, where files are shared between Apache + SFTP, especially if you have more than on SFTP user.