0

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?

0

4 Answers 4

1

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

2
  • 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, 2009 at 4:19
  • As long as the group read/write/execute bits are set correctly, yeah.
    – Carl Norum
    Nov 5, 2009 at 4:21
1

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.

1

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

Example:

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.

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .