Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have set up an sftp account in /home/sam, created a group sftp, and added the user sam in it. i gave chown sam:sftp /home/sam for the user to perform operations in that directory.

Now I have created another sftp account tom and I have to make him share the directory /home/sam. i.e., both sam and tom has to share the same directoy for common files. Now I can't give chown tom:sftp on /home/sam. How do I make the directoy sam shareable to both users?

share|improve this question

migrated from serverfault.com Jan 20 '13 at 18:30

This question came from our site for system and network administrators.

Which operating system and version? – Christopher Jan 20 '13 at 19:02
Are we talking about sftp from sshd or from some ftp server package? – John Siu Jan 20 '13 at 20:19

Assuming a commonly used linux distribution and sshd service running.

1) If you want two users to be able to create, delete and modify files under the same directory, then just create one account and provide the credentials to both people. That's the easiest way, however...

...if you want to log their activity separately, e.g. who logged when, then create two users with the same group and assign the same home directory to both of them. E.g.

groupadd sftp
mkdir /home/sftp
chown nobody:sftp /home/sftp
chmod 770 /home/sftp
useradd -d /home/sftp -g sftp sam
useradd -d /home/sftp -g sftp tom

if users sam and tom already exist and have their own primary group, then chmod g+s /home/sftp will force files created under this directory to inherit its group id.

Check this other post for how to force a default umask under sftp, so files uploaded are group read/write-able.

2) If you want only one user to create, delete and modify the directory contents and a second user to have read-only access. This doesn't really need any special handling, normal users can read contents from other users' directories. The second user will just have to specify or cd to the target directory (however, you may assign the same home directory to the second user).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.