1

Beginner user here.

I want to change root username to something else? Is that possible, and if yes - how to do it?

idjuradj
  • 111
  • 2

2 Answers2

1

Yes it is possible, but not recommended. The username root is not magical. The fact that it has a UID of 0 is what gives root its power. Tools like /bin/ls that translate between the UID value in a file's inode and a name (unless you /bin/ls -n) use the password database (See man nss;man nsswitch.conf) to do the translation. The getent command fetches entries:

 $ getent passwd root  
 root:x:0:0:root:/root:/bin/bash

(See man 5 passwd;man shadow for info about the contents.)

So, you could edit /etc/passwd, find the line with the UID of zero, and change the user name of root to some other value.

What do you suppose you have gained? Do you know of any program dumb enough to check for $USERNAME = "root" rather than$UID = 0`? The system sure doesn't.

waltinator
  • 36,399
0

No, it is not possible. In Windows, you can have guests and admins. In Ubuntu, there are guests, admins and the root. And nobody can actually BE the root, only use root powers. So no, there is no way to change the root's name.

Eduardo Cola
  • 5,817