In as root but buffer says read only

Posted on 2008-11-19
Last Modified: 2013-12-13
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
Question by:solunatec
    LVL 29

    Expert Comment

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


    then add root password
    LVL 29

    Accepted Solution

    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)
    LVL 61

    Expert Comment

    use vi and post exact errors you get.
    LVL 15

    Expert Comment

    If you are using VI, you can sometimes force a write with the ":w!" command.
    LVL 24

    Expert Comment

    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



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
    Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    This tutorial goes over how to archive and restore FreeBSD jails that are managed by ezjail.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now