|
From: | Bob Proulx |
Subject: | Re: I'am root user, but 'emacs /etc/sudoers' still report Buffer is read-only: #<buffer sudoers> in modeline |
Date: | Wed, 29 Apr 2015 02:25:54 -0600 |
User-agent: | Mutt/1.5.23 (2014-03-12) |
Show Dont wrote: > I want to edit /etc/sudoers for add 'git ALL=(ALL:ALL) ALL' in it. I > am ready the root user, but emacs still can not edit the > /etc/sudoers. Use C-q C-x to toggle read-only status. It starts off read-only because the file permissions are read-only. If you are the root superuser then you can toggle the buffer read-only status and then edit the file anyway and override the file permissions on save and write the file anyway. Here is the documentation. https://www.gnu.org/software/emacs/manual/html_node/emacs/Misc-Buffer.html Specifically for the suders file it is a good idea to use the 'visudo' command to edit that file. It will make a copy of the file for editing and then will validate the syntax before saving. It prevents typos and accidents breaking the sudo configuration, which might prevent a sudo only user from having sudo to fix the problem. 'visudo' respects the EDITOR variable and will invoke emacs as the editor if EDITOR is set to emacs. I highly recommend using the visudo command for editing the /etc/sudoers file. It will make a writable copy and therefore you won't need to toggle the read-only status. Bob
[Prev in Thread] | Current Thread | [Next in Thread] |