Add new user with permissions same as existing user

12,032

You should create a new user as Hauke is right in indicating that creating two with the same UID is going to be confusing ( you could do that with useradd -u EXISTINGUID ... )

You probably just want to make a new user and make sure they are in the same group and that the group permissions are so that they can work with the data in the same group in the same way. Most installations now seem to make a group per user, so if your existing user is named exus you have a groupname exus in /etc/group as well, note the gid (group id) and all the other groups that exus is a member of (vboxuser, dialout etc -> `gid2, gid3). Create the new user with:

useradd -N -g gid -G gid2,gid3 -m

(You could have them use the same home directory by replacing -m with --home ~exus, not sure if that is what you want)

Make sure that all of the group permissions of the new files created by both users are based on a umask of 002 or 007 and that permissions on existing files owned by the exus have the group permissions the same as the user permissions:

find / -user exus -print0 | xargs -0 chmod g=u
Share:
12,032

Related videos on Youtube

Rishi Raj
Author by

Rishi Raj

I am a intermediate Java programmer. Am also passionate for linux. My choice of class of linux systems is RPM-based.

Updated on September 18, 2022

Comments

  • Rishi Raj
    Rishi Raj almost 2 years

    How to create a new user with permission exactly same as an existing user in linux.

    • daisy
      daisy about 11 years
      Exactly the same is ambiguous
    • Anthon
      Anthon about 11 years
      Do you want a different user with permissions such as granted by the groups the existing user has. Or do you want the new user to be able to access everything as the existing user but have a different login name? Maybe a bit more information on what you try to achieve and why you think 'creating a new user with permissions exactly as an existing user' is a solution makes things more clear.
    • Rishi Raj
      Rishi Raj about 11 years
      @Anthon, I want the new user to be able to access everything as the existing user but have a different login name.