Hay In A Needlestack

Fri, 22 Jul 2011

Read-only Bind Mount

If you need to bind mount some directory in read-only mode (to securely access a backup dir, for example) it is necessary to first bind mount and then remount in read-only mode.

At least on Fedora, you can perform these two steps automatically using /etc/fstab. Just create a pair of entries like these:

/source/dir            /destination/dir    none  bind            0 0
/source/dir            /destination/dir    none  remount,bind,ro 0 0

I've tested this in a Fedora 14 box. YMMV.

Update: This trick only works if your distribution does a mount -a during boot. If your distribution uses systemd, you can try this other hack.

Posted at: 22:58 | Category: /fedora | permalink

Copyright © 2007,2008,2009,2010 Gustavo M. D. Vieira