Today, I experienced a heart-stopping moment when I mistakenly executed sudo rm /etc/group
on my Linux machine. My intention was merely to edit a line within the file, not obliterate it entirely! In a moment of distraction, I accidentally deleted the crucial /etc/group
file. This file is essential for Linux system permissions, defining the different user groups. You can imagine the cold sweat moment!
Why it's an issue?
The /etc/group
file plays a vital role in Linux systems, managing user group memberships and permissions. Deleting it with sudo rm
can lead to issues like losing sudo privileges and encountering permission errors.
The Recovery Process
Good thing is that system occasionally backs up files in /etc
folder. If there's group
there's also an older group-
file.
Unfortunate that I could no longer sudo from the current user, since group
file no longer existed.
If you run into this kind of issue:
Reboot your computer
Choose Advanced options for Ubuntu
Select drop to root shell prompt
When a root terminal opens, you know what to do.
Lesson learned
Besides not doing sudo rm -rf ...
, which can happen again btw, it's a good idea to add etc
folder to versioning.