Some weeks ago I was doing some stuff with our ubuntu machine and I don't know how I did manage to do it but I kicked our one and only user out of the sudoers list. But I didn't really notice until trace told me that the Administration menu was quite empty and most of the options didn't appear anymore :O But there's still hope! I found a general indication in the forum thread "Add an account to the sudoers list". I'll detail it a bit so that next time I break it I can fix it even quicker than today :D
Boot ubuntu, using ubuntu's live cd (you'll need to be physically in front of the computer, no VNC or ssh connections will work, so you need a keyboard and mouse connected to the computer).
Then once it's booted, open up a terminal and do:
sudo mkdir /myhdThat's for mounting the harddisk on the filesystem. As we need a place where to mount it, I create /myhd and then link my first hard disk (which is where the linux partition is, you should change it depending on your configuration) to it. Man mount for more info ;)
sudo mount -t ext3 /dev/hda1 /myhd
Don't worry about /myhd, it's in the virtual filesystem which gets created when the livecd is executed, and it will dissappear when you close the session.
Sudoers in ubuntu seem to be the ones which are in the admin group. So, for example, when you run the package manager and it asks you for the password, it does it so that it can run sudo and effectively give you root privileges temporarily. It also seems that the Admin menu is built depending on the actual privileges of the user, and as it was not in the admin group, he wasn't shown admin options anymore. Pretty logical/obvious! Now we need to edit the /etc/group file to add us back to the admin group:
sudo gedit /etc/groupThere was a line which said
admin: x:112:So I added my user to that line, like
admin: x:112:myuserIf there had been more users, the way to add more several users to a group is simply to separate their names with commas:
admin: x:112:myuser,anotheruserThen I saved the file, crossed the fingers and rebooted the computer - and it worked :) :)
Let's set aside the security of this solution (i.e. allowing a user to add himself to the admin group just by running a livecd) and celebrate that we're back in the sudoers list!