soledad penadés
repeat 4[fd 100 rt 90]

Becoming a sudoer again

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 /myhd

sudo mount -t ext3 /dev/hda1 /myhd

That'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 ;)

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/group

There was a line which said

admin: x:112:

So I added my user to that line, like

admin: x:112:myuser

If 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,anotheruser

Then 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!

// 3 responses to Becoming a sudoer again

Zarate
Zarate
20061004

Ummm, are telling us that anyone with an Ubuntu LiveCD can add himself to the admin group on ANY Ubuntu installation????????????

That sounds really bad : (

sole
sole
20061004

Seems like … yes!
When you run the livecd you're root so that way you can perfectly mount the hard disks, and modify them as you please.
Maybe there are ways to secure it, I'm pretty sure there must be some solution, but I haven't found yet (specially because I haven't looked for it).
In a normal world you shouldn't be letting your computer physically accessible to everybody, should you? :D

Zarate
Zarate
20061005

No, I won't, but now I cannot say during the typical James Bond film (you know, when he arrives to the evil's computer and access it with a cd):

"That's impossible"

:S

You came late to the party

Comments are closed, but if you want to comment anything about this entry please let me know using the info in this page.