Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In windows it is possible to change administrator username for security reasons. Is it possible to change root username in Linux too?

share|improve this question
1  
Security through obscurity won't really help you. Take the proper precautions such as disabling root SSH access rather than trying to hide your root account. –  j883376 Jul 1 '13 at 7:12
    
You can try: make another user with UID==0 and check whether all services will run under that account. If you won't meet problems, you can change shell of "real" root to /sbin/nologin and clear his password. –  Eddy_Em Jul 1 '13 at 7:48
    
Just to join the choir: the reason this is a security practice on Windows is because they allow direct Administrator access to the machine over the network. You can still usually tell by the SID which is the Admin account, though. If the administrative account doesn't have that then it's not a huge deal that people know what the account's name is. –  Joel Davis Jul 1 '13 at 16:39

2 Answers 2

up vote 5 down vote accepted

While it's technically possible, it is probably not a good idea. You would have to audit all the code on your system to check if any of it has the root user name hard-coded.

While the recommended practice for e.g. shell scripts is to check the user ID (if it's zero, you are root) or check for the actual privilege you require (if you can write a file where you want to, who cares which precise user you are running as) but not all programs adhere to the recommendation. (In fact, the installers and/or packaging scripts for many popular commercial software packages contain some truly atrocious shell scripting.)

A hack which was employed by BSD once upon a time was to have a duplicate user in /etc/passwd with the same user and group ID, but a different user name (and a different shell, which was the purpose of this exercise); they called this user toor. This hardly helps for your particular use case, but may still be useful as guidance. The fact that this (generally) worked is a good indication that you could simply rename root altogether.

share|improve this answer
1  
I tend to rename my linux uid 0 accounts to 'toor' to have an uniform account name on all my servers. So I know it is possible. It also help to identify broken software which checks for account names. –  Hennes Jul 1 '13 at 12:27
    
@Hennes Thanks for the report from the field! Could you try to quantify the amount of actual breakage? The fact that you have observed some might already be enough to deter some experimenters, though. –  tripleee Jul 1 '13 at 13:13

It's possible to change the name of the root account: edit your passwd file. You'll break stuff, because various applications assume that the root account is called root. (That's why it's called a “root account”, after all.)

Renaming a system account isn't supported any more than renaming some random system file is supported, or applying rot13 to a system file.

There is zero security benefit in renaming the root account. It will not help against any exploit. Root exploits work by causing a program running as root to execute code that it shouldn't execute. The name of the account is completely immaterial. It's like painting your front door a different color: it won't help you against burglars, you need to work on having a good lock, barring your windows, etc.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.