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.
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.
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.