Tuesday, September 8, 2009

Enable root login in Ubuntu

Logging in as root on Linux machines can be a touchy subject. Conventional wisdom says to never log in as root. However, there are functions that only the root user is able to do which requires the use of the sudo and su commands. In keeping with this idea of never logging in as root, Ubuntu ships with root logins disabled. Instead, the first user created is given the power to use the sudo command and assume root privileges. If you have an Ubuntu but want to enable the more conventional root login, here is how you do it:
$ sudo passwd root
You will immediately be prompted to enter, then confirm a new UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Now you can login as root like you would any other user.

1 comment:

  1. I personally dislike this method. If you want a root shell, you can run "sudo su -" at any time. If you want it to be remotely accessible, you can add an ssh key to root's .ssh2/authorized_keys file. In both cases, you can retain the security of having root's account refuse password authentication, but still allow its use.


Note: Only a member of this blog may post a comment.