Re: Cannot save changes to sudoers



"Nick.Name" <JLuckey@xxxxxxxxxxx> said:
Linux Newbie just installed Fedora Core 5 for i386. After editing
sudoers in gedit it fails to save w/ error msg:
Could not save file /etc/sudoers
You are trying to save this file on a read-only disk. Please check
that you have typed the location correctly and try again.

I am logged-in as root. I have created other files in the /etc
directory successfully.

The error message would, as Tauno suggested, indicate that the root
filesystem is mounted read-only -- but the fact that you can create
other files successfully in /etc even when you're getting this error
(I hope you tested this just now, not just "I've created files in
/etc some time in the past"), tells that the filesystem is mounted ok.

Couple of things, though:

Do not edit the sudoers file with any other command but visudo.
This is because visudo makes a syntax check to the file before saving,
and prevents you from saving a broken sudoers file. If "vi" is not
your favourite editor, you can set the environment variable VISUAL
to indicate your favourite -- for example, entering the following on
the command line:
export VISUAL=joe
visudo
.... would start sudoers editing session in joe -- and still have all
the safety belts enabled. Note that you need root privileges to run
visudo (or, actually, to edit the sudoers file at all).

It could be that for some reason your sudoers file is set immutable.
See what you get with "lsattr /etc/sudoers". If you get just
------------- /etc/sudoers
then the extended attributes have not been set, and there shouldn't
be any "extra" difficulties, but if you have anything else there
(especially a "i" somewhere among the minus signs, then the file
is set immutable, and you need to "chattr" it to not immutable;
see the manual pages for "lsattr" and "chattr" for details).
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
.



Relevant Pages

  • Visudo invokes GNU nano rather than vi
    ... The last time I went near the sudoers file, the command sudo visudo ... I've just been editing sudoers, and this time, on Breezy Badger, I'm ... getting GNU nano as editor. ...
    (Ubuntu)
  • Re: Cannot save changes to sudoers
    ... sudoers in gedit it fails to save w/ error msg: ... You are trying to save this file on a read-only disk. ... I am logged-in as root. ... Why won't it let me save the edited sudoers? ...
    (comp.os.linux.setup)
  • Re: sudo and privoxy
    ... (by using visudo). ... Well, as root, I tried using]# nano -w sudoers to add one line. ...
    (Fedora)
  • Re: Sudoers problem
    ... > you edited the file with something other than visudo. ... > If you did than perhaps you should post your complete sudoers file... ... I was missing the "*" on the end. ...
    (alt.os.linux.suse)
  • Re: Firefox 1.5.0.7 RPM
    ... I need root password to sudo. ... because sudoers can do just as stupid things as root. ...
    (alt.os.linux.suse)