I was trying to modify the /etc/group
file, and accidentally cleared its contents. Now, I can't even use sudo
anymore, and I don't know what else is broken. How can I fix this?
1 Answer
Piecing together information from the Internet, I learned that the system apparently backs up some files, including /etc/group
, to /var/backups/[filename].bak
. Sure enough, I booted to a live USB, mounted my HD, cd'd to /media/ubuntu/[hard drive]
, and ran:
sudo cp var/backups/group.bak etc/group
Then, when I rebooted, my system was good to go. Additionally, you can also boot the system to a root shell. (I've seen how, but I can never quite remember how.) Then, once you've mounted your rootfs as rw and all that, you'd use:
cp /var/backups/group.bak /etc/group
Another option would be to check if /etc/group-
(note the dash) does exist. If it does you can inspect it and copy it back to /etc/group
.
-
Why the hell does it want me to wait two days before I can accept my own answer? That's just stupid. Commented Oct 7, 2015 at 3:47
-
It's an auto-mechanism set for all questions in case a 'better answer comes along'. A question must be open for a few day, I assume, unless closed my a moderator. Commented Oct 7, 2015 at 3:49
-
@Rinzwind How would accepting your own answer be abused? It's not like you get rep from your own answer or anything. Commented Oct 7, 2015 at 14:57
-
This will explain it better: meta.stackexchange.com/questions/6044/… And here is the abuse I was talking about: meta.stackexchange.com/questions/6044/… You indeed get no rep BUT you do attract upvotes for having accepted answers all over the place.– RinzwindCommented Oct 7, 2015 at 15:08
-