I was tinkering with the /etc/passwd file when accidentaly changed the root UID and GID. When I enter into the recovery mode, I still have no superuser powers, as any user exists on the passwd file with UID and GID 0. I read something about booting the pc from a live cd and mounting a partition, but I don't fully understand what does this mean. Maybe you can give me a solution and a link to a tutorial or just explain it here step by step. Thank you in advance :)
1 Answer
A little bit like this: https://help.ubuntu.com/community/LiveCdRecovery
You boot Linux from the Live CD (not using it as a replacement boot loader, but booting into the Live CD installation).
Then mount the partition containing /
of your hard disk installation, similar to the tutorial.
Stop before doing chroot
! Just cd
the the directory where you mounted it, enter etc
, cp passwd passwd.backup
for good measure (in case your cat jumps on the keyboard one moment later) and vi passwd
.