How to create a new user with permission exactly same as an existing user in linux.
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
/etc/group as well, note the
gid (group id) and all the other groups that
exus is a member of (
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
--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
You can (probably not with the tools, though) create a new user with the same UID like an existing user. One of the problems is that only one user will see the correct (his own) user name for file system objects, processes and so on.
Another approach is to keep the system free of references to the username (which will probably not work within $HOME) and instead create a group with just the two users as members and manage all access rights with group rights only.