1

How can I give a new user all permissions of another existing user?

The use case is that I serve a website of a specific user, let's call him "webuser". The webroot is /home/webuser/WWW. I would like to give the same permissions to users specific to that user to all of my coworkers. However I would prefer to all give them their own user, so no credentials have to be shared.

2 Answers 2

1

You should read about the concept of groups in unix systems. The /home/webuser/www directory (and everything inside) should have be in group (for example "group1"). Webuser and another user should be members of this "group1". But remember that you should have the same rights on files and directory for owner and group.

The second solution, but very, very dirty, is to create another user with UID of webuser.

4
  • thanks, I will read about groups. The reason I thought this would not work is because /home/webuser/WWW is in the user directory. But of course I could grand the new users access.
    – Thomas
    Jun 11, 2018 at 15:08
  • To access /home/webuser/www by another user you have to add +x permission (at least) to /home and /home/webuser. With configured group access will be enough. Jun 11, 2018 at 15:13
  • +x is the execute permission? but I understand what you try to say: add all the users to the same group and grand them permissions. check!
    – Thomas
    Jun 11, 2018 at 15:16
  • 1
    Yes, +x for directory does not mean you can "run" directory but you can "enter" this directory. To list files you need to have "+r", to write "+w", but to access directory, you must have "+x" for all of it's parent's directory. Jun 11, 2018 at 15:19
0

There is a 'hacky' way, that works sometimes - just change UID of new user to match the old user's one.

The legacy way is to use group permissions for this.

The proper way is to tag files with appropriate ACLs (getfacl/setfacl).

2
  • but wouldn't that change user a to user b. I would like to create multiple users and also retain user a (user webuser)
    – Thomas
    Jun 11, 2018 at 15:07
  • Users sharing single UID used to have their own $HOME, but yes, they are equal in terms of system itself. So this solution makes sense only when those multiple accounts are designed especially for this single task, and their owners are not going to use their accounts for anything else. Jun 11, 2018 at 15:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .