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
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SOme files are permitted to be changed by root only. First you will have to become root.


then add root password
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)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
use vi and post exact errors you get.
If you are using VI, you can sometimes force a write with the ":w!" command.
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
and after-save-hook


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.