Multiple Users with owner rights?

21,137

Solution 1

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

Solution 2

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.

Solution 3

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

Share:
21,137

Related videos on Youtube

user 99572 is fine
Author by

user 99572 is fine

Updated on September 17, 2022

Comments

  • user 99572 is fine
    user 99572 is fine over 1 year

    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?

    Tom

  • joaquin
    joaquin over 14 years
    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).
  • isomorphismes
    isomorphismes almost 11 years
    @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