In order to have multiple people able to update the same directories/files:

1. Create directory that multiple user to access.

# mkdir /var/www/html/site1.com

2. Create the group that needs to be able to write to the directory.

# groupadd webdev

3. Change the group associated with the directory.

# chgrp webdev /var/www/html/site1.com

4. Make the directory group writable.

# chmod g+w /var/www/html/site1.com

5. Change the SGID of directory so that any new files retain the group ownership

# chmod g+s /var/www/html/site1.com

6. Create the new user, adding the additional group(set the home directory if necassary).

# useradd -G webdev -d /var/www/html/site1.com user1

7. Change the umask so that newly uploaded files retain group writable permissions:

# vi /etc/ssh/sshd_config

Update the sftp subsytem line to look like so:

Subsystem sftp /bin/sh -c ‘umask 0002; /usr/libexec/openssh/sftp-server’

For chrooted sftp:

Subsystem sftp /bin/sh -c ‘umask 0002; internal-sftp’

Note: if you are trying to make these changes to a directory structure that already exists, any changes to permissions will need to be done recursively.

Leave a Reply