Debian/Ubuntu Tips and Tricks

Debuntu

Debian/Ubuntu Tips and Tricks

Ubuntu Default Root Password or the sudo way

Posted by chantra on April 24th, 2006

The first time I installed Ubuntu on a computer, I was rather used to debian and went through the whole install process easily.

When I rebooted my system and open a text-console, my first action was to su - in order to gain root's grants. What a surprise when I was promted for a password. Damn, What was it?!?


Through the installation process, I was asked to enter a username, I entered my usual username, type and confirmed my password, but I was never asked to enter the super-user root's password!?!

On a usual debian install, you are actually asked for root password and eventually you may want to create a first normal user(which is actually safer).

Ubuntu being a bit more user friendly, thought it was easier for the user to be promted for his password when he wants to do administration actions such as installing software, updating the system... To do this, ubuntu uses the sudo package which allow a user to gain root access for an action. In order to make sure that the user in front of the computer is actually the real user (not somebody using your access), the user is prompted for his password.

In Ubuntu, by default, there is not really a root user, but only root access which can be gained using sudo, for instance, to update your repository list:

:~$sudo apt-get update

Root is created without predefined password, it does not have a password, but it does not have an empty password either, you just can't login!!!

I actually like to be logged as root when I've got many this to do. I find sudo usefull when only one or two actio are to be done, but when doing administration task, typing sudo all the time just drive me cray :).

One way to gain root prompt is to launch a shell as root. Therefore, using sudo you can type:

:~$ sudo sh
Password:
sh-3.1#

And there you are, you have a root shell.

If you want to be able to login as root, you need to define a password for root:

:~$ sudo passwd
Password:
Enter new UNIX password:
Retype new UNIX password:

Now you can login as root with su.

9 Responses to “Ubuntu Default Root Password or the sudo way”

  1. Thank you chantra I was finding the solution and I got your blog and it help me to set my ubuntu root password.

  2. I know this article is old, but it's still highly relevant to Ubuntu distro's today.

    I installed Lubtuntu recently, and was too curious about the installer not prompting for a root password. I'm also familiar with Debian, and setting up root is just another Linux normality for me.

    Cheers for the clear guidance on setting up the root password via the terminal.

  3. if you want to become a root user with your ubuntu 12. go to your terminal i.e dos, remember u are still a user with the $. To become the root simply type sudo passwd root
    it will ask you for your user password first the unix password twice. Then you will be longin as root#. Thanks

  4. I am using Ubuntu first time. At the installation time it asked for username and password. Now it asking for password for root and not accepting that password.Please frnds tell me what to do with it that i m able to work on Ubuntu. Thanks in advance..

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>