My understanding of UIDs is that is a unique positive integer assigned by a Unix-like operating system to each user. Each user is identified to the system by its UID, and user names are generally used only as an interface for humans.
How can two users have the same UID, isn't this a conflict for my system and packages?
root@kdc:~# id test12
uid=1005(test10) gid=1000(server) groups=1005(test10)
root@kdc:~# id test13
uid=1005(test10) gid=1000(server) groups=1005(test10)
root@kdc:~#
I've added two users with same UID and GID: test12
and test13
The output of /etc/passwd
:
client@kdc:~$ cat /etc/passwd | grep test12
test12:x:1005:1000::/home/test12:/bin/sh
client@kdc:~$ cat /etc/passwd | grep test13
test13:x:1005:1000::/home/test13:/bin/sh
I added the users by useradd -ou 1005 -g1000 username.
I got confused what is the purpose of this, and can it affect permissions and user logs etc. So now if a user is added with uid=0
and gid=0
will has privileges like a root account?
Best Answer
The answer here is that Linux does not protect you from yourself.
If you really want to
su root
and go into the /etc files and give all the users the same UID, you can. It's just a text file.But you really shouldn't and it will have unintended consequences.