chroot

I locked myself out of my laptop. I'd been away for a while and when I got back I spontaneously not only forgot my password but my username as well, which is bad, since the login screen on my arch installation is just a tty.

I had a linux distro on an SD card lying about, which I booted into instead, with the intention of reading the /etc/passwd file to discover what my username was. But whilst waiting for the thing to boot, I was searching online to see if anyone had a similar problem and that's when I learned about chroot.

From the manpage:

chroot - run command or interactive shell with special root directory

The long and short of it is it lets you change the / root of your filesystem for a given shell. So, after mounting the partition of the machine I had forgotten my login for, I could

chroot /mnt passwd root

and change the root password, reboot, and login fine.

Proxy Information
Original URL
gemini://gemlog.cosroe.com/technical/chroot.gmi
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
1661.117789 milliseconds
Gemini-to-HTML Time
0.516507 milliseconds

This content has been proxied by September (3851b).