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? |
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).
|
Quote:
|
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. |
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.
|
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! |
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. |
All times are GMT -5. The time now is 06:29 AM. |