LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Cannot log in as root after sudo config (https://www.linuxquestions.org/questions/debian-26/cannot-log-in-as-root-after-sudo-config-4175429444/)

cryingthug 09-28-2012 09:44 AM

Cannot log in as root after sudo config
 
I am no longer able to log in as root. Is there an easy way to fix this?

I configured sudo like this:

Code:

root ALL=(ALL) ALL
steve ALL=(ALL) ALL

It worked. Then I wanted to remove sudo access for steve. So I did this:

Code:

root ALL=(ALL) ALL
#steve ALL=(ALL) ALL

I logged out then back in.
I was not able to do this: su -
It gave the error:

Code:

command steve: file or folder does not exist.
I then tried to change the root password by booting to init=/bin/bash.
That was successful. But I was not able to change to root in the terminal.

I then delete the x in second field on the root line in /etc/passwd .
root:x:....
Also the long string of characters in the second field of root in /etc/shadow.
root:$as87aeofuhdu9a8oeu.....

No luck.

So I did this:

Code:

cp -v /var/backups/passwd.bak /etc/passwd
cp -v /var/backups/shadow.bak /etc/shadow

No luck.

What can I try now????

suttiwit 09-28-2012 10:33 PM

Try removing the
Code:

#steve ALL=(ALL) ALL
so it should now be:
Code:

root ALL=(ALL) ALL
only.

certainquirk 10-03-2012 07:42 AM

visudo
 
Was there some reason you chose not to use visudo? In Debian, visudo will drop you into nano. Make the changes (esp as suttiwit suggested) and then hit F3 (save). If there are probs with the strict structure of the sudoers file, then visudo will report it back to you. If all's well, save the changes and hopefully you'll be OK.

Personally, I've found that changing things willy-nilly as root is NOT a very good idea.

Quote:

I then delete the x in second field on the root line in /etc/passwd .
root:x:....
Also the long string of characters in the second field of root in /etc/shadow.
root:$as87aeofuhdu9a8oeu.....

cryingthug 01-23-2013 08:20 PM

certainquirk:

I think that I did use visudo. The problem is when I tried to undo it. I should have left it the way it was when it was working.
I fix it myself some kind of way.


All times are GMT -5. The time now is 10:44 AM.