5

I was thinking, maybe I'd like to disable passwords for the root user and only use keys to log in. If I need to log in without keys, I’d have a 2nd user that is like root in every way, except it 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?

6

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.

| 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? – user4069 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
5

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?

| 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 'SO- stop being evil' Mar 11 '11 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy