I host my websites on my Linux server each out of their own accounts (e.g. /home/siteA-com/http, /home/siteB-com/http etc.). I chown www-data on the inner files for the http folders so that the server can make changes where needed (namely for Wordpress). How can I also allow these users to SFTP into these directories and be able to change files?


You need to make more groups (and set the appropriate group permissions), or use ACLs.

|improve this answer|||||
  • Ok so if I make a group that both the www-data and SiteA-com user belong to and chgroup on that directory to be that group, then both users will be able to change files? – Kyle Hayes Nov 5 '09 at 4:19
  • As long as the group read/write/execute bits are set correctly, yeah. – Carl Norum Nov 5 '09 at 4:21

Even though this probably belongs on ServerFault, I'll go ahead and answer it.

I presume the users are in the same group, if not, you will want to do that through your access control system (ACL, LDAP, etc). If they're all in the same group, you can give group permissions by doing

chmod g+rXw /path/to/file

See the appropriate man pages (chmod, usermod, etc) for more options.

|improve this answer|||||

It's mentioned in the first reply, but the answer really is Unix Access Control Lists, it extends the standard unix file permissions into something a lot more flexiable and specific.

These two commands are your friend:

  • setfacl - set ACLs
  • getfacl - see current ACLs

They really are awesome, they can be set recursively and also set the default permissions of all new files and folders (so you don't have to keep settings perms over and over again when you make new files).


Apache & FTP can read/write httpdocs, but the user joebrown can only read httpdocs.

setfacl -R -m u:apache:rwx ./httpdocs
setfacl -R -m u:ftpuser:rwx ./httpdocs
setfacl -R -m u:joebrown:r-x ./httpdocs

You can run the same commands with the -d flag to set it as default policy for new files too.

|improve this answer|||||

What I do is put my users under "dev" and set the public_html directory as follows.

chgrp dev public_html chmod 775 public_html

|improve this answer|||||

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.