Support Questions
Find answers, ask questions, and share your expertise

Unable to login as root - setuid not 0, permission denied to edit /usr/bin/sudo

Highlighted

Unable to login as root - setuid not 0, permission denied to edit /usr/bin/sudo

Explorer

Hi All-

I did some chmod/chown changes on all and since then I am not able to login with root user.

sudo command is not working.

Tried all the options available online, still getting this error-

"sudo: effective uid is not 0, is sudo installed setuid root?"

I know that the uid for the file /usr/bin/sudo must be set to 0 but currently it is 1 and i am not able to change it.

 

As soon as I launch the VM it opens with user "cloudera" by default.

Is there any way to launch the VM with root user?

Anyone know if this can be fixed while restarting the VM?

 

Just want to fix this without re-installing the complete VM. Thanks, appreciate any help/insights on this.

8 REPLIES 8
Highlighted

Re: Unable to login as root - setuid not 0, permission denied to edit /usr/bin/sudo

Contributor

Hi @SandyCT,

 

can you give us more details? For example, which version of the Cloudera QuickStart VM are you using?

There is a way to log in as root, but it's non-trivial, so I suggest we confirm there's no other way.

For starters, can you post the output of

"ls -la /usr/bin/sudo" from that QuickStart VM?

These virtual machines are based on Centos 6.4, which by default can be rebooted in "safe mode", which should give you access to both your hive data, and the fix to the sudo ownership.

But if you ask me, I would

1) fix sudo

2) back up all I need from that VM (hive, etc), and

3) start from scratch, using those backups.

If you did what I think you did, sudo will not be the only thing that is not working.

 

Regards,

samurai

Highlighted

Re: Unable to login as root - setuid not 0, permission denied to edit /usr/bin/sudo

Champion

Hi 

 

Just fire the below command in the terminal  if you are using QuickStartVm

 

sudo su 

 Quickstart SudoQuickstart Sudo

Highlighted

Re: Unable to login as root - setuid not 0, permission denied to edit /usr/bin/sudo

Contributor
Hello @csguna,
I don't mean to intrude, but the problem described is caused by the permission or owner of the sudo command being changed, and sudo command has built-in checks against tampering, so that has to be fixed externally, for example by rebooting into some form of rescue mode. That being said, the email I've received from your post said "sudo su Password - cloudera". Did you edit your post? Or is there something else going on?
Regards

Re: Unable to login as root - setuid not 0, permission denied to edit /usr/bin/sudo

Contributor

Actually, suggestion from @csguna gives me an idea - @SandyCT, if you can open a normal terminal, you can also execute "su -" as command. It will ask for root password, so try to give it same default password you had for cloudera user - by default it is "cloudera". If you are lucky, and "su" binary is unaffected by your chmod/chown, you just might get to root, and from there we'll manage.

Please try, and let us know.

 

Regards

Highlighted

Re: Unable to login as root - setuid not 0, permission denied to edit /usr/bin/sudo

Explorer

Hi, @csgunathanks for your reply, this solution wont work. I have been using sudo for a long time but this occurred after a permission change using chmod 777 and now "sudo su" wont work, I am getting below error:-

sudo: effective uid is not 0, is sudo installed setuid root?

Highlighted

Re: Unable to login as root - setuid not 0, permission denied to edit /usr/bin/sudo

Contributor

Hi @SandyCT,

 

you should try the suggestion from my last message - if you didn't break "su" binary as well, command "su -" might give you root access. When prompted, give it the root password ("cloudera" by default, if you haven't changed it).

 

Cheers,

samurai

 

 

Highlighted

Re: Unable to login as root - setuid not 0, permission denied to edit /usr/bin/sudo

Explorer
@samurai
I already tried these options, none of these work.
when i do "su -" followed by password I get this
su: cannot set groups: Operation not permitted

ls -ltr /usr/bin/sudo
-rwxrwxrwx. 1 root root 123832 /usr/bin/sudo

1. Not sure what is the "." at the end of permissions rwx.
2. I have to change the group of this sudo file to '0' but to do that also I should have sudo access, so its an endless loop.
3. I think there is no way to reset it while booting a cloudera machine either.

Currently I am working on another VM but I will have to alter all the configurations settings again what I did so far, as when the error occurs.
Highlighted

Re: Unable to login as root - setuid not 0, permission denied to edit /usr/bin/sudo

Contributor

Hi @SandyCT,

well, this system is broken a bit more than I expected, since owner of groups is also damaged. What did you run exactly? If I had to guess, some recursive chmod on /, or /etc?

Before you try this last option, try switching to console (ctrl+alt+F1 on a normal pc, not sure about the vm), and logging in as root, with password "cloudera".

If this does not work, for whichever reason, here's a way to reboot Centos 6 in "safe mode". I suggest you make a backup of the whole vm file/directory first.
https://lintut.com/reset-forgotten-root-password-in-centos/
If this does not work (I cannot test now, since I don't have my vm around), replace " 1 " in the tutorial with "rw init=/bin/bash"
In either case, this will grant you root, but fixing your vm might take a while. For example, your sudo command should be "---s--x--x", or something to that regard, /etc/sudoers "-r--r-----", and "/etc/group" -rw-r--r--.
Have fun & good luck! :)