Can I recover from moronic loss of the root password?

5 respostas [Última entrada]
cdupree
Desconectado
Joined: 07/03/2013

Extreme moronism alert! It appears that I've forgotten my root password, since I'm unable to 'su' successfully. I thought I knew what it was but when I enter any variation of that it fails, as do all the other tries I can think of.

Is there any way out of this self-created problem short of reinstalling?

oldfolio
Desconectado
Joined: 06/20/2013

If you have a Trisquel live cd (or another GNU/Linux installation), boot into that and open a terminal emulator. Then, with root privileges:

1) mount the installation for which you've forgotten the password

2) chroot into the installation you just mounted

3) use passwd to set a new password

I just double-checked that you can do this using my Trisquel live cd, and it went like this:

trisquel@trisquel:~$ sudo su
root@trisquel:/home/trisquel# mkdir /mnt/sda1
root@trisquel:/home/trisquel# mount /dev/sda1 /mnt/sda1
root@trisquel:/home/trisquel# chroot /mnt/sda1
root@trisquel:/# passwd oldfolio
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

/dev/sda1 is my Trisquel installation
oldfolio is my administrative user

** UPDATE ** If you're simply su'ing that may be failing since Trisquel requires you to use sudo as an administrative user.

cdupree
Desconectado
Joined: 07/03/2013

Oh, so that could be it; I was trying to use a naked 'su' and I didn't know that wasn't allowed on Trisquel. Makes sense, and thanks for the help!

Thanks also for the details on how to fix the loss of the root password. I'm obviously no expert in this area, but doesn't that trick mean that physical Trisquel (and I imagine nearly all Linux) machines can be invaded by someone with the right bootable CD? Not that I'm worried, mind you 8-), but it did occur to me.

Thanks again!

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

'sudo -i' gives you a root terminal ($HOME is /root and so on) with your user password.

TralfamadorianOrator
Desconectado
Joined: 11/12/2011

…doesn't that trick mean that physical Trisquel (and I imagine nearly all [GNU/Linux]) machines can be invaded by someone with the right bootable CD?

This vulnerability exists on all operating systems, not just GNU/Linux systems. That's why encryption is a good idea.

https://trisquel.info/en/wiki/full-disk-encryption-install

lembas
Desconectado
Joined: 05/13/2010

su will not work because the root password is locked by default, one is expected to use sudo.

So, to become root use sudo su, which asks for YOUR password and not root's.

In case you have forgotten YOUR password, you need a live media. Or another OS which can access your /etc/shadow file.

If an attacker has physical access to your box, you've lost. Only a full disk encryption can defend against that (and might also bite you in the ass should you forget that password!).