LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sudoers oooopsies (https://www.linuxquestions.org/questions/linux-newbie-8/sudoers-oooopsies-913193/)

toonmariner 11-12-2011 12:10 PM

sudoers oooopsies
 
Hi peeps,

I was getting annoyed at the authentication request on installing new software - looked at sudoers and had NOPASSWD : ALL on admin and sudo so I stupidly removed the % at the start of each line.

I have tried entering via recovery mode as root to fix this problem but when editing via sudo visudo it states file system is read only and if I attempt to su root with my password I just get authentication failure.

bit stuck on what to try next and would dearly love to avoid booting from disc (mainly because I can't find my usb and don't want to wipe my install completely).

Any help would be very much appreciated.

Nominal Animal 11-12-2011 12:47 PM

If you can login as root, you can fix the problem by directly modifying the /etc/sudoers file. To get root login, you can always reboot to single-user or recovery mode.

visudo is not necessary in single-user mode. It is a wrapper around a normal editor (defined in EDITOR environment variable, defaults to some editor, usually vi), which makes sure the file is edited atomically; that all other processes see either the old contents, or the new contents, but never anything that combines the two. It is used to avoid race conditions and editing mishaps, but is in no way required.

Therefore, if you can login as root, you can then edit the sudoers file using your favourite editor, for example using nano (nano /etc/sudoers) or vi (vi /etc/sudoers).

toonmariner 11-12-2011 01:48 PM

I have booted via recovery mode, option menu presents 'root - drop to root shell prompt'.

However using nano /etc/sudoers when I attempt to save edits it says file system is read-only!

is there a difference between single-user and recovery mode? if so how do you enter single-user mode as I have not attempted that...

Nominal Animal 11-12-2011 02:32 PM

Quote:

Originally Posted by toonmariner (Post 4522411)
I have booted via recovery mode, option menu presents 'root - drop to root shell prompt'.

However using nano /etc/sudoers when I attempt to save edits it says file system is read-only!

Ah, that just means your recovery mode mounts the root filesystem read-only. It is a good thing; it means no changes are done (can be done!) to the filesystem, unless you explicitly allow it. (If one of your disks crashes, it is better that the system does not attempt to do any fixes, or do any changes at all to the disk contents, before you have had the opportunity to safely copy (or try to copy) your files to some other storage media.)

Fortunately, you only need to run one command to switch from read-only file system to a normal one:
Code:

mount -o remount,rw /

toonmariner 11-12-2011 03:02 PM

THANK YOU!

I'd have your babies if I had the lady equipment...


All times are GMT -5. The time now is 03:34 AM.