Andy’s Blog

Just another weblog

A little knowledge really is a dangerous thing

I made a slight mistake yesterday. I managed to remove myself from the admin group. Which of course means I can no longer run ‘sudo’, which means I can’t put my self back in the group.

What happened was I wanted to add myself to a new group. For this I typed: usermod -G newgroup myuser what I didn’t realise was this replaced my list of groups instead of adding to them. Luckily I typed groups myuser to check what groups I was in. On discovering that I was not in all the groups I should be I used groups to save a copy of all the groups I was supposed to be in (this was my previous groups because I hadn’t logged out).

Unfortunately I could not replace my groups because that would require me to be root and sudo was checking I was an admin (which I no longer was).

Don’t worry though, I rebooted and selected recovery mode and restored the groups I should have had. But it just goes to show a little knowledge can be dangerous. (In hindsight it would have been wiser to have used the “Users and Groups” GUI program. Of course it could have been done using the CLI with adduser myuser newgroup).

Maybe I should create a backup admin account in case I mess something up again?

At least I have learnt something, and isn’t that what matters?


April 4, 2008 Posted by | Uncategorized | 1 Comment