I have bought a VPS and I am busy with setting up a FTP server. This is working now, but i can give only one account owner rights. So i have made a group 'administrators' with 2 users. The problem is that i can give only one user owner rights. Now i am using the next code:

chown -r user1:administrators /var/websites
chown -r user2:administrators /var/websites

Only the last user(user 2) has now owner rights. What must i do to give both users administrator rights?


migrated from stackoverflow.com Jan 18 '10 at 5:28

This question came from our site for professional and enthusiast programmers.


Change the directory's group ownership with

chgrp -R administrators /var/websites

then change the group permissions for that directory using chmod

chmod -R g+rwx /var/websites

substitute rwx with the permissions you want to give your administrator users

  • 3
    Note that there's still only one user with owner rights; that's fixed. But that user can give the group members appropriate access rights. Consider using the SGID bit on the directories to ensure that files created in them belong to the same group (the administrators group). – Jonathan Leffler Jan 17 '10 at 15:48

Just like anything on a *nix system, there are many ways to do it.

To use groups, set the umask to 002 and do the following

find /var/websites -type d | xargs chmod 775
find /var/websites -type f | xargs chmod 664

That should give the group read/write access to all files and directories.

If you're filesystem supports it which it probably does (most likely ext3), you can also use ACLs. Do a Google search for "Linux acl" and that should give you some howtos.

Finally, you can always do the hackerish thing which is to set the UIDs for both users the same. The name is arbitrary, the UID is really what gets used when looking at permissions so just have two users with the same UID and that should work as well but be aware that if you have other stuff you want to protect from each user, that won't work as they will be effectively the same user and have all the same privileges.


Permissions on Unix filesystems only have one user. Use group permissions to give multiple people write access.

  • sorry, i have searched on google, but i don't find anything. do you have a example? – Tom Jan 17 '10 at 15:19
  • @Tom It's chown vs chgrp. You would want to use info chown or man chown from the command line or google on chgrp / chown rather than "use group permissions". Here are some examples: thegeekstuff.com/2012/06/chown-examples – isomorphismes Jun 7 '13 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy