In as root but buffer says read only

Sometimes when I enter a configuration file:

ie.   cp dhcpd.conf.sample dhcpd.conf
emacs dhcpd.conf

I cannot make any changes becuase it says read only: I need to make changes
solunatecAsked:
Who is Participating?
 
TeRReFConnect With a Mentor Commented:
Sorry, I didn't notice the title. You say you're logged in as root? Then all text files should be writable. If not, try this as root:

Go to the directory the file you want to edit is in.

Then do this (as root)

chmod 644 your_filename

Then try to edit again (as root)
0
 
TeRReFCommented:
SOme files are permitted to be changed by root only. First you will have to become root.

su

then add root password
0
 
gheistCommented:
use vi and post exact errors you get.
0
 
dfxdeimosCommented:
If you are using VI, you can sometimes force a write with the ":w!" command.
0
 
fridomCEO/ProgrammerCommented:
Permissons can deny write rights to root. So check  the permissions of the file e.g you could do  
C-x d get a directory listing
M to change the mode
edit the file
return back to the directory listing
M to set the permissions to read-only again

or you can try
M-x toggle-readonly

or you can modify the find-file stuff to change the permissions to allow  write access then modify the buffer and then after-file-save you set the mode to read-only again, ther are hooks for that
find-file-hook
and after-save-hook

Regards
Friedrich

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.