Multiple Users with owner rights?

5

3

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

Tom

Posted 2010-01-17T15:00:57.240

Reputation:

Answers

6

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

Silvio Donnini

Posted 2010-01-17T15:00:57.240

Reputation: 762

3Note 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 – 2010-01-17T15:48:40.053

3

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.

Jim

Posted 2010-01-17T15:00:57.240

Reputation: 131

2

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

outis

Posted 2010-01-17T15:00:57.240

Reputation: 388

@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: http://www.thegeekstuff.com/2012/06/chown-examples/

– isomorphismes – 2013-06-07T11:51:06.800

sorry, i have searched on google, but i don't find anything. do you have a example? – None – 2010-01-17T15:19:15.263