Monday, February 19, 2007

Make a Filesystem Read Only

For security reasons, you may want to make a filesystem read only. You will have to modify the /etc/vfstab file. The "ro" option is inserted into it. Here is an example using the /usr filesystem.

# vi /etc/vfstab
#
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
...(other entries go here)
/dev/dsk/c0t0d0s6 /dev/rdsk/c0t0d0s6 /usr ufs 1 no logging,ro
...(other entries go here)
:wq! (saves and quits vi)

To write to the filesystem
remove the "ro" option from the /etc/vfstab and reboot

OR to make it temporary ("ro" restored after reboot)
# mount -F ufs -o rw,remount /usr

No comments: