My idea for this thread came today when I borked myself on my server. We can confess dumbs&!t things we did and how we solved them!
Wait...
...I'll start
I access my headless server remotely through ssh, which means I do almost everything using the command line. I needed to add my one-and-only user on this server to the lpadmin group, so I blithely typed this:
sudo usermod -G lpadmin smith
and then I closed the terminal and terminated the ssh connection. Voilà! I torpedoed my sole user out of every other group on the machine and made lpadmin my primary group...
...great, just great. What I wanted to type was:
sudo usermod -a -G lpadmin smith
That little -a adds the group to your list of groups. Without it, well you get the picture. Here's the fun part: I was no longer a member of the sudo group. Why is that important? Because I was no longer able to access any system commands - I could not add myself back into any groups or do much of anything other than log in and out. I couldn't even reboot the machine. Sigh.
If I had not closed the connection, I might have been able to fix it right there, but that ship had already sailed.
The fix: At least I was smart enough to have configured the power button action so it performs a normal shutdown when pressed. I attached a monitor and keyboard and powered it back up. Then I booted into recovery mode from the grub menu and selected the "fsck" option. This will run a disk check, mount the drives read-write (instead of read-only) and then re-offer you the recovery menu. Then I selected "Drop to a root shell" option. This gave me root access and a read-write filesystem. If you choose Root Shell initially, you get a read-only filesystem.
From here, I simply re-added all the necessary groups and dropped out of the recovery mode back to normal running mode.
I suppose a good "safety" feature might be to have a second admin user or even install a root user password. But at least I know how to fix this one.
Wait...
...I'll start
I access my headless server remotely through ssh, which means I do almost everything using the command line. I needed to add my one-and-only user on this server to the lpadmin group, so I blithely typed this:
sudo usermod -G lpadmin smith
and then I closed the terminal and terminated the ssh connection. Voilà! I torpedoed my sole user out of every other group on the machine and made lpadmin my primary group...
...great, just great. What I wanted to type was:
sudo usermod -a -G lpadmin smith
That little -a adds the group to your list of groups. Without it, well you get the picture. Here's the fun part: I was no longer a member of the sudo group. Why is that important? Because I was no longer able to access any system commands - I could not add myself back into any groups or do much of anything other than log in and out. I couldn't even reboot the machine. Sigh.
If I had not closed the connection, I might have been able to fix it right there, but that ship had already sailed.
The fix: At least I was smart enough to have configured the power button action so it performs a normal shutdown when pressed. I attached a monitor and keyboard and powered it back up. Then I booted into recovery mode from the grub menu and selected the "fsck" option. This will run a disk check, mount the drives read-write (instead of read-only) and then re-offer you the recovery menu. Then I selected "Drop to a root shell" option. This gave me root access and a read-write filesystem. If you choose Root Shell initially, you get a read-only filesystem.
From here, I simply re-added all the necessary groups and dropped out of the recovery mode back to normal running mode.
I suppose a good "safety" feature might be to have a second admin user or even install a root user password. But at least I know how to fix this one.
Comment