Ubuntu. Accidentally changed ownership of sudo

Nithin

Senior member
Dec 31, 2002
961
0
76
I changed owner to normal user. Now I can't do sudo anymore.
Say it needs to be setuid root.

I can't change it back now because sudo won't work.

root account is not enabled.

anything i can do? :(

N.
 

bersl2

Golden Member
Aug 2, 2004
1,617
0
0
Either boot a live CD (perhaps even the install CD might work for this), mount the filesystem with sudo on it, and change the ownership that way, or if you can add init=/bin/bash at the bootloader's command line, then you will bypass everything that normally happens just after the kernel hands control over to userland and be dumped at a root shell; you can then remount the filesystems read/write and change ownership that way.
 

Nithin

Senior member
Dec 31, 2002
961
0
76
my first thought was the live cd option. the prob is that its a vmware install. it doesn't see the virtual hdisk when i boot through live cd.
i will try the init option.

[Edit] init= didn't work. i changed the boot line in grub.
but are you sure about it? if this actually worked it would be a huge
security blunder right?

N.
 

bersl2

Golden Member
Aug 2, 2004
1,617
0
0
Originally posted by: Nithin
my first thought was the live cd option. the prob is that its a vmware install. it doesn't see the virtual hdisk when i boot through live cd.
i will try the init option.

[Edit] init= didn't work. i changed the boot line in grub.
but are you sure about it? if this actually worked it would be a huge
security blunder right?

N.

It should work (though maybe something VM-related is interfering). It's one reason why one should lock down the BIOS, the boot order, and the bootloader on machines where untrusted parties can gain physical access.
 

Nithin

Senior member
Dec 31, 2002
961
0
76
i see. then i dunno why it didn't work. i changed it like you said. it did the same thing it normall does.
went upto the graphical login.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Boot into single user mode and change it there. I don't know how grub does it, check the man page.

Don't mess with the permissions of things outside of ~/.
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
To get in a root terminal try Rescue or Recovery mode??

Well once you're in the root terminal you need to do

chown root /usr/bin/sudo
chmod 4111 /usr/bin/sudo

I think that should do it.

I did the same stupid thing to my friend's Ubuntu and he said he fixed it with those commands I later told him. Just wondering, did you change the permissions of the whole /usr/bin directory or just sudo? I actually changed my friend's whole /usr/bin directory by mistake and we just decided to reinstall it. Even though we fixed sudo, lots of other things got screwed up.
 

TanisHalfElven

Diamond Member
Jun 29, 2001
3,512
0
76
Originally posted by: Nithin
my first thought was the live cd option. the prob is that its a vmware install. it doesn't see the virtual hdisk when i boot through live cd.
i will try the init option.

[Edit] init= didn't work. i changed the boot line in grub.
but are you sure about it? if this actually worked it would be a huge
security blunder right?

N.

yeah single use mode should do it.
enter it
type
deluse <username>
adduser -u 1000 -g admin <usename>

might want to check the command using tabb cuiz i am not sure about spelling and stuff.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
[Edit] init= didn't work. i changed the boot line in grub.
but are you sure about it? if this actually worked it would be a huge
security blunder right?

You are changing it on the kernel line in grub, right? Just add init=/bin/bash after the root=/dev/blah entry.

And no it's not a security blunder that you can do this, the real blunder would be you allowing untrusted people to physicall access your machine.