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.

I was thinking, maybe i'd like to disable passwords for the root user and only use keys to log in. and if i need to login without keys have a 2nd user that is like root in everyway except has a different name.

Is there a way to have a 2nd root user? Is this impossible? is it a bad idea to disable passwords?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

Instead of creating a "second root user", just give another user account privileges to use sudo. That way if the root account is hosed, you can just do sudo bash or such to have root access to the system again. Although it is better to just use sudo for individual commands...

Some distro's such as Ubuntu are actually configured this way out-of-the-box, as a security measure.

share|improve this answer
    
I use debian which is very similar to ubuntu. How do i make this 2nd user have access to sudo/sudo bash? –  acidzombie24 Mar 11 '11 at 20:47
    
@acidzombie24 To give another user access to sudo you need to add them to /etc/sudoers –  user5648 Mar 11 '11 at 21:33
2  
But for sanity's sake, use the visudo command. NEVER edit /etc/sudoers manually, especially if you're not sure what you're doing. –  Shadur Mar 11 '11 at 23:29
    
Best of all, I think, is to edit sudoers once to make some group (wheel is traditional) have the ability to act as root. Then, later, you just need to add users to that group to give them sudo privileges, with no more risky editing of the config file. –  mattdm Mar 12 '11 at 0:50

I've actually seen a system set up the way your describe. It had two lines in /etc/passwd for user ID 0 (root):

root:x:0:0:root:/root:/bin/sh
toor:x:0:0:root:/root:/bin/csh

Or something like that. I think it was a SunOS 4.1.x system, a long time ago, so maybe you can't do this on a modern Linux system. I'd say go ahead and give it a try. What can it hurt?

share|improve this answer
2  
That works on Linux, and probably on every unix variant. There's a single user, but there are two user names, each with their own password (or lack thereof), home directory and shell. –  Gilles Mar 11 '11 at 21:49

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.