Find the answer to your Linux question:
Results 1 to 10 of 10
Hello everyone, I am interested in making the root file system is read-only on RHEL 5.3. I've moved /var and /tmp file systems to another partitions. There are two files ...
  1. #1
    Linux Newbie ursusca's Avatar
    Join Date
    Dec 2008
    Location
    Toronto
    Posts
    112

    [SOLVED] Make the root file system read-only on RHEL 5.3

    Hello everyone,

    I am interested in making the root file system is read-only on RHEL 5.3.
    I've moved /var and /tmp file systems to another partitions.
    There are two files in the /etc directory that need to be writable. These are:
    /etc/mtab
    /etc/resolv.conf

    I've moved this files to /var and linked it.
    I've added command to the /etc/rc.d/rc.local file:
    mount -o remount,ro /

    That's it.

    Are there other solutions to make the root file system is read-only?

  2. #2
    Linux Newbie rituraj.goswami's Avatar
    Join Date
    Aug 2008
    Location
    Guwahati
    Posts
    133
    edit your fstab and put the parameters ro in it.
    There is nothing impossible, for everything is possible; the impossible only takes a bit longer than the possible.

  3. #3
    Linux Newbie ursusca's Avatar
    Join Date
    Dec 2008
    Location
    Toronto
    Posts
    112
    Quote Originally Posted by rituraj.goswami View Post
    edit your fstab and put the parameters ro in it.
    I edited my fstab:
    LABEL=/ / ext3 ro,defaults 1 1
    But unfortunately it didn't help me. After reboot I got rw root file system.

  4. #4
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    665
    I think the defaults may overwrite your request to make it ro. by default, the defaults are activated, you just need to put `ro` in that spot, exclude the `,defaults`

    why would you want to make it read only though? Only root can write to it, and if someone has root access, then your root filesystem being writeable is the least of your problems.
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

  5. #5
    Linux Newbie ursusca's Avatar
    Join Date
    Dec 2008
    Location
    Toronto
    Posts
    112
    Quote Originally Posted by meton_magis View Post
    I think the defaults may overwrite your request to make it ro. by default, the defaults are activated, you just need to put `ro` in that spot, exclude the `,defaults`

    why would you want to make it read only though? Only root can write to it, and if someone has root access, then your root filesystem being writeable is the least of your problems.
    Thank you, meton_magis! But I exluded the `defaults` and I didn't help me. After reboot I got rw root file system. The reasons why I would want to make my root partition read only:
    To avoid that power loss or system crash damage the root partition.
    To avoid unforeseen errors.

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    I'm not sure you can make the root file system read-only. As for protecting it from power failures or system crashes, if you mount it on an ext3 or other logging file system, then it will not likely be so damaged. In my case, I also keep a backup bit-image of the system drive on an external device so I can easily restore the system to a known-good-state if it ever gets so munged that normal fsck recovery doesn't work. Which reminds me, I need to do that now!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #7
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,099
    I would think that having it read only all the time could become problematic. I keep image backups on hand like Rubberman commented on above, but I actually keep two separate image backups on hand, both on external drives just in case one of them should be found corrupted when it's needed. The added measure of security doesn't take but a few minutes, but could save me many hours down the road.
    oz

    new members/users: read this first | new member faq
    no private messages requesting computer support - post them on the forums!
    please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.

  8. #8
    Linux Newbie ursusca's Avatar
    Join Date
    Dec 2008
    Location
    Toronto
    Posts
    112
    Thanks to one guy from CentOS forum I found /etc/rc.d/rc.sysinit script where root is remounted rw. I think there are 2 possibilities to make the root file system is read-only on RHEL 5:
    adding remount comand to the /etc/rc.d/rc.local file.
    commenting out the line in the /etc/rc.d/rc.sysinit scripts contains the remount.
    And I agree that having it read only all the time could become problematic but I simply want to try it.

    Thanks everyone for replying!

  9. #9
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,099
    Yes, if you are able to accomplish it, please do report back and let us know how it works out for you because I'm rather curious about it myself.
    oz

    new members/users: read this first | new member faq
    no private messages requesting computer support - post them on the forums!
    please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.

  10. #10
    Linux Newbie ursusca's Avatar
    Join Date
    Dec 2008
    Location
    Toronto
    Posts
    112
    Quote Originally Posted by ozar View Post
    Yes, if you are able to accomplish it, please do report back and let us know how it works out for you because I'm rather curious about it myself.
    Hello

    My dial-up server with read-only root file system has been working fine for over 5 month.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...