Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Is it possible to safely downgrade the user 'root', replacing it with a different account name? (say 'admin'). So, in the end, 'admin' would be uid 0 and 'root' 123.

I am using Centos, if that makes any difference. What worries me is if any of the standard services use root hardcoded (cron scripts maybe?) and that causes everything to fail.

Thanks!

share|improve this question
2  
Why do you want to do this? –  Kyle Smith Apr 6 '12 at 1:02
    
I can't get into the reason as it comes down to corporate data/policies etc., sorry. The end goal is to have 'root' as a limited user. –  john Apr 6 '12 at 1:10
2  
I tried renaming the root user on an SLS Linux system many years ago (before Linux 1.0 was even out) just for fun. I didn't create an ordinary user called root, just renamed the UID 0 user to admin. As I recall, a few minor things broke but most of the system kept chugging along without a problem. –  David Schwartz Apr 6 '12 at 1:27
    
That 's great to know, thanks!! –  john Apr 6 '12 at 1:44

1 Answer 1

up vote 5 down vote accepted

In essence you want to rename the account named root. If you think about it, that's the same as replacing it with a different account (same uid, different name).

Plenty of people will tell you not to, however if you take everything into consideration, it could be done and that without terrible consequences. The trouble comes when an application or script assumes that the root user is named root rather than searching for the root user via uid. I think that's not as much of a problem now as it once was.

What you'll need to do is edit /etc/passwd, /etc/shadow, /etc/group, and /etc/gshadow. From there, the changes will need to be application specific. For instance, for postfix, you'll likely want to grep root in /etc/ and change the aliases to point to the new name.

Other apps will need to be dealt with as needed. For much more info, there's a question over on unix.stackexchange.com titled "How do you rename root?" that has an interesting, CentOS specific answer from someone who sought PCI compliance for his organization by changing the default name for the root account.

P.S. Back everything up twice before you edit your system files.

share|improve this answer
    
Awesome answer! Thanks a lot! :) –  john Apr 6 '12 at 1:07

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.