LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 09-28-2012, 09:44 AM   #1
cryingthug
Member
 
Registered: Jun 2009
Posts: 131

Rep: Reputation: 18
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????
 
Old 09-28-2012, 10:33 PM   #2
suttiwit
Member
 
Registered: Aug 2012
Location: Chiang Mai, Thailand
Distribution: Kubuntu 12.10 x86_64
Posts: 192
Blog Entries: 2

Rep: Reputation: 22
Try removing the
Code:
#steve ALL=(ALL) ALL
so it should now be:
Code:
root ALL=(ALL) ALL
only.
 
Old 10-03-2012, 07:42 AM   #3
certainquirk
LQ Newbie
 
Registered: Nov 2008
Location: High Dry Plains of Colorado
Distribution: Debian 7, Linux Mint 13 (12.04 LTS), UbuntuStudio 12.04 LTS--all are XFCE
Posts: 9

Rep: Reputation: 1
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.....
 
Old 01-23-2013, 08:20 PM   #4
cryingthug
Member
 
Registered: Jun 2009
Posts: 131

Original Poster
Rep: Reputation: 18
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
sudo cd /root gives 'sudo: cd: command not found'. stf92 Linux - Newbie 4 03-03-2012 09:05 AM
[SOLVED] Arg! Virtual machine, sudo won't work, can't log in as root, visudo won't work Arg! edpatterson Linux - Newbie 2 01-03-2012 05:33 PM
howto log usage of shared account (root account) after `sudo su -` drManhattan Linux - Server 5 09-30-2011 07:48 AM
Can't use sudo, only account that's not root is not a sudo'ers [Ubuntu 9.10] randyriver10 Linux - Desktop 1 01-09-2010 07:56 PM
How to Log everything command in a root-shell started by SUDO dussel Linux - Security 13 02-21-2006 09:47 AM


All times are GMT -5. The time now is 05:25 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration