how to create a new root password

Asked by Brian Dove

I keep being asked for a root password, I don't remember creating one. What should I do?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
PeterPall (peterpall) said :
#1

That's a big difference between Ubuntu and other Linuxes I know - so I had to do loads of research work in this point, too:

If you do anything that you wouldn't want everybody that just went into your room to be able to do Ubuntu asks you for your own password - not the one for the root user - just to check that it is really still you.

So in theory you won't need any password for root - and by default there even is no root account on Ubuntu.
If you really want to create a root account add the following line to /etc/passwd (e.G. after typing "sudo gedit /etc/passwd") into a terminal:

root:x:0:0:root:/root:/bin/bash

This will add a account for the root user, but still no password for it so the next step would be

sudo passwd root

..and choosing one.

But again: You can create a superaccount on Ubuntu if you want to - but you won't really need it, since Ubuntu will always ask you for your own password instead.

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#2

Please use:

sudo -i

if you want to use a plain root account without setting it...

passwd

to change or set a root password

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#3

I don't remember user and password what i can do

You can do this: http://www.psychocats.net/ubuntu/resetpassword

or

To discover your user and restore (change) the password you can:

Start the pc the when you see the GRUB row...

Press ESC.

Press "e" for edit.

Highlight the line that begins kernel ………, and press "e"

Go to the very end of the line, add rw init=/bin/bash

press enter, then press "b" to boot your system.

Your system will boot up to a passwordless root shell.

Type in grep -i 1000 /etc/passwd

The system must show a row with your user name at the start of the row
for example:
danilo:x:1000:1000:ubuntu,,,:/home/danilo:/bin/bash

Here my user is danilo

Then to change your user password type in:

passwd username

or

passwd -d username

change username with your real user

Set your password.

Type in:

reboot

or

reboot -f

Hope this helps

Revision history for this message
Brian Dove (briandove01) said :
#4

Thanks for all the replies, but unfortunately I still have the problem. Specifically, I have downloaded a driver for my printer but when I try to install it a dialogue box opens asking me for the root password. I have tried entering my user password but it doesn't work. I don't remember setting a root password when I installed Ubuntu.

Revision history for this message
PeterPall (peterpall) said :
#5

If this program really expects that there is a root password open a terminal and do the following:

sudo bash
<type in your own password>
echo root:x:0:0:root:/root:/bin/bash>>/etc/passwd
passwd root
<now choose a root password and type it in twice>

This should set up a root account for you.

Revision history for this message
Brian Dove (briandove01) said :
#6

Hi
Thanks for your answer. I'm sorry to be so stupid but I am a new user, how
do I open a terminal?

On Fri, Aug 27, 2010 at 8:26 AM, PeterPall <
<email address hidden>> wrote:

> Your question #121561 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/121561
>
> Status: Open => Answered
>
> PeterPall proposed the following answer:
> If this program really expects that there is a root password open a
> terminal and do the following:
>
> sudo bash
> <type in your own password>
> echo root:x:0:0:root:/root:/bin/bash>>/etc/passwd
> passwd root
> <now choose a root password and type it in twice>
>
> This should set up a root account for you.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/ubuntu/+question/121561/+confirm?answer_id=4
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+question/121561
>
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
Brian Dove (briandove01) said :
#7

Hi, I found how to open a terminal and I followed your instructions but it
said "permission denied"!

On Fri, Aug 27, 2010 at 8:26 AM, PeterPall <
<email address hidden>> wrote:

> Your question #121561 on Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+question/121561
>
> Status: Open => Answered
>
> PeterPall proposed the following answer:
> If this program really expects that there is a root password open a
> terminal and do the following:
>
> sudo bash
> <type in your own password>
> echo root:x:0:0:root:/root:/bin/bash>>/etc/passwd
> passwd root
> <now choose a root password and type it in twice>
>
> This should set up a root account for you.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/ubuntu/+question/121561/+confirm?answer_id=4
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/ubuntu/+question/121561
>
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
PeterPall (peterpall) said :
#8

I assume you have tried
echo root:x:0:0:root:/root:/bin/bash>>/etc/passwd
instead - which seems to be much more logical but has one drawback: It executes the "echo" command as root - but the ">>/etc/passwd" that appends the output to this file is executed with your permissions again.

If that isn't the problem you can try

sudo gedit /etc/passwd

on the terminal and add the following line to the file that opens after typing this command:
root:x:0:0:root:/root:/bin/bash

Then save the file, close the editor and type in the following:
sudo passwd root
Now Ubuntu has to let you choose a root password.

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#9

Please restore your user password instead of create this unusual conf... you might have issue if you do it...

http://www.psychocats.net/ubuntu/resetpassword

Revision history for this message
PeterPall (peterpall) said :
#10

The configuration is unusual for ubuntu. But it seems that one application on the system in question really needs an root account; The instructions that are to be found under http://www.psychocats.net/ubuntu/resetpassword are extremely valuable, but they tell how to recover the user's password - but this password is known to the user already.

Can you help with this problem?

Provide an answer of your own, or ask Brian Dove for more information if necessary.

To post a message you must log in.