15

I can sudo, but I don't have the root password so I can't su root. Using sudo, can I change the root password?

6 Answers 6

27

So you want to run something like sudo passwd root?

0
18

You can also just use

sudo su

and keep the root account without password.

2
  • 2
    Once I understood I can do this, I did "passwd -d root". Thanks!
    – ripper234
    Commented Mar 17, 2011 at 13:21
  • But why was my answer downgraded after having been accepted ?
    – philfr
    Commented Mar 17, 2011 at 15:52
8

Try this:

sudo passwd

Note that you also want to log in using su - instead of su (more info).

4

If you have your sudo password then try the following (this is on Ubuntu 14.04LTS):

ewan@user-sbc-ihsw:~$ sudo -i
[sudo] password for ewan: 
root@user-sbc-ihsw:~# passwd
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
root@user-sbc-ihsw:~# whoami
root
3

you can also use sudo with the "-i" option. this will log you in as root without using the su command.

sudo -i

1

You can change all these options in sudoers file, even make no password if you want( I would not recommend this though).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .