I need a little help with configuring Ubuntu Server 14.04, apache2 and SFTP for multiple separate users. Every user needs to have website in his home directory, for example: /home/user/public_html available using http://user.mydomain.com. Also every user must be able to make SFTP and SSH connection but access must be restricted to /home/user. I don't know if it matters but all users will be using php, mysql and git on their accounts.

I've tried a lot of tutorials to achieve what I need but none of them worked for me. Every time when one thing works well other breaks :/

I will be grateful for any kind of help with this. Links, documentation, books are welcome.

  • I feel it's better to tell what you tried and what didn't work rather than asking for a one size fits all solution. Jan 27, 2015 at 12:40

2 Answers 2


Have you considered adding the users who need access to the www-data group? I am fairly certain that apache runs as www-data on Ubuntu 14.04. If you add the users to this group you wont have to mess with chmod on that folder - which always has the potential to break apps that are currently in use.


hi for me working in this way, first you need add users to a group "sftpgroup", later modify

nano /etc/ssh/sshd_config

and edit add this to config file

Subsystem sftp internal-sftp -f AUTH -l VERBOSE
Match Group sftpgroup
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no

later modify for write and access

sudo chown root /home/bob
sudo chmod go-w /home/bob
sudo mkdir /home/bob/writable
sudo chown bob:sftpgroup /home/bob/writable
sudo chmod ug+rwX /home/bob/writable

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.