Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Possible Duplicate:
How to know my root password?

Instead of letting you set a password for root during install Ubuntu set it to * for no password and disables the actual account login, however even with this being said you can still use root in ubuntu by sudo.

So how to set a root password on Ubuntu?

share|improve this question

migrated from unix.stackexchange.com Jun 24 '12 at 4:41

This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems..

marked as duplicate by izx, Uri Herrera, jokerdino, fossfreedom Jun 25 '12 at 8:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2  
Why do you want to have a root password? You don't need it; any time you need root access, you can use sudo. –  Keith Thompson Jun 24 '12 at 3:26
    
@KeithThompson is necessar a root password to use sudo –  Zignd Jun 24 '12 at 3:49
    
@Zignd: No, sudo requires your password, not the root password. Ubuntu is designed to work without a root password. See help.ubuntu.com/community/RootSudo –  Keith Thompson Jun 24 '12 at 15:24
    
@KeithThompson sorry I wrote it wrong, I checked it and you are correct x) –  Zignd Jun 24 '12 at 15:29

3 Answers 3

up vote 17 down vote accepted

Warning: Directly logging in as root is like playing with fire, because one little typo is enough to lose critical data or make your system unbootable. Note that desktop environments will also function incorrectly if you login to them as root.

See these questions for the reasons behind why sudo is preferred and why root-login is disabled by default:

  1. What are the benefits of sudo over su?
  2. Why is there no option to login as root?

You may have noticed that you can’t login to root account on Ubuntu, this is because root doesn’t actually have a password set.

Type the following command:

sudo passwd

The following message will appear:

[sudo] password for [username]: [Type your user password and press return]

After that another message will appear, the following:

Type new UNIX password: [Type the root password you want]

Now the last thing you need to do, the following:

Retype new UNIX password: [Retype the root password you chosen before]

The following message will appear:

passwd: password updated successfully

If the above message showed up on your terminal, you can now use the root privileges by typing:

su

And then type the password you chosen. That's it!

Else, start over the steps of the answer, you probably typed something wrong.

share|improve this answer

What I do to create the root on ubuntu: first I do this

sudo -i

then

passwd

as @Zignd mentioned the classical messages will appear:

Type new UNIX password: [Type the root password you want]
Retype new UNIX password: [Retype the root password you chosen before]
passwd: password updated successfully

then I can use the su as a normal root acount...

share|improve this answer

If you still want to use su after reading the warnings in the question, there is no need to set a root password. Just do sudo su and you're on your way with your regular password.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.