LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-15-2011, 03:48 PM   #1
faizlo
Member
 
Registered: Sep 2008
Location: USA
Distribution: Linux Mint Qiana
Posts: 190

Rep: Reputation: Disabled
removed myself from sudoers list


Hi,

This does not seem to be my day. For some reason (mostly experimenting) I used sudo visudo and removed my name (the whole line) from there. Now, of course, I cannot use sudo any more. I cannot even use "sudo su" to be root. The whole system is unaccessible to me now.

I followed this link:
http://www.psychocats.net/ubuntu/sudo

but I could not use 'sudo visudo' from the root command line. It said root is not in the sudoers file. This incident will be reported.

I don't get this, how can root be not in the sudoers list?
Any solution(s) to this issue?
 
Old 12-15-2011, 04:30 PM   #2
thesnow
Member
 
Registered: Nov 2010
Location: Minneapolis, MN
Distribution: Ubuntu, Red Hat, Mint
Posts: 170

Rep: Reputation: 56
You could boot into single-user mode which should drop you in as root to run visudo, or you could boot with a live CD, then mount the disk partition and edit /etc/sudoers manually (if the first way doesn't work).
 
Old 12-15-2011, 06:02 PM   #3
joeldavis
LQ Newbie
 
Registered: Mar 2011
Posts: 28

Rep: Reputation: 1
Quote:
Originally Posted by faizlo View Post
Hi,
I don't get this, how can root be not in the sudoers list?
Because the function of sudo is to execute things with root permissions so it doesn't make sense to use sudo something when (as far as unix permissions go) you have full control. IIRC most sudoers files are still marked as nonwritable even by root, but root can still force the issue (because it's root) in vim by using the ":w!" command.
 
Old 12-15-2011, 06:45 PM   #4
faizlo
Member
 
Registered: Sep 2008
Location: USA
Distribution: Linux Mint Qiana
Posts: 190

Original Poster
Rep: Reputation: Disabled
visudo by itself did not work. It said root is not allowed to change it!
I will try the live-CD solution once I find it.
 
Old 12-16-2011, 10:03 AM   #5
joeldavis
LQ Newbie
 
Registered: Mar 2011
Posts: 28

Rep: Reputation: 1
yes /etc/sudoers is usually not writable by anyone but since you're root you can for the issue in vi by just adding an exclamation point.
 
Old 12-16-2011, 11:25 AM   #6
faizlo
Member
 
Registered: Sep 2008
Location: USA
Distribution: Linux Mint Qiana
Posts: 190

Original Poster
Rep: Reputation: Disabled
Will here is what I did:

booted to the recovery mode, and then dropped to the root command. When I typed "visudoers" it said I cannot edit this file (yes, root cannot edit the file).

Then I went to vi, I typed "vi /etc/susdoers" and I was greeted with an empty file. Changed to edit mode, (pressed i) and was giving a warning; E303: Unable to open swap file for "/etc/sudoers", recovery impossible!
I typed my info any way, "faizlo ALL=(ALL) ALL" - without the quotes, and I could not save the file with :w!. Emacs had the same luck (of course!)

Well, any ideas!?

PS. I don't have the live-CD because I keep updating my box 2 months after each release!
 
Old 12-16-2011, 11:40 AM   #7
faizlo
Member
 
Registered: Sep 2008
Location: USA
Distribution: Linux Mint Qiana
Posts: 190

Original Poster
Rep: Reputation: Disabled
Solved.

I found an old live-CD (10.04) and out of nothing else to do to save my system, I used it (after all, it should give me some way to mount my system partition) following some windows I asked for a root command which I used to "vi" my file.

All seems fine now.

Thanks guys.
 
  


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
[SOLVED] sudoers list citi Linux - Newbie 15 01-27-2011 10:03 PM
sudoers question about cmnd_alias/list and directories. trey85stang Linux - General 2 12-02-2010 04:59 PM
How do I add myself to the sudoers list? Cultist Debian 6 07-26-2010 07:31 PM
sudoers list Pedroski Fedora 4 11-06-2009 11:20 AM
New GDM, how do users get added/removed from the list MikeyCarter Linux - Software 2 05-21-2008 06:04 PM


All times are GMT -5. The time now is 09:01 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration