Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

mount -r --bind /media/NTFSPartition/ftp/public /media/NTFSPartition/ftp/users/user1/public

This gives me warning

mount: warning: /media/NTFSPartition/ftp/users/user1/public seems to be mounted read-write.

and of course mounting in rw mode :( What I need is to make it read only mount.

share|improve this question
Interesting. I don't get that warning here (Fedora 12). But it also doesn't seem to make it R/O, despite what mount says :> – Ignacio Vazquez-Abrams Sep 6 '10 at 2:51
up vote 1 down vote accepted

Probably it needs to be done in two commands:

mount --bind /media/NTFSPartition/ftp/public /media/NTFSPartition/ftp/users/user1/public
mount -o remount,ro /media/NTFSPartition/ftp/users/user1/public

Other ways to do it:

  1. Use aufs/unionfs.
  2. Mount using FUSE (like fusexmp)
share|improve this answer
Would aufs/unionfs work in case of partition formatted as NTFS and initially mounted as ntfs-3g? – Pablo Sep 6 '10 at 4:51
Yes, it should (at least aufs has compile-time configuration option "Allow FUSE as a branch"). – Vi. Sep 6 '10 at 9:48
Do that two commands fail for you? – Vi. Sep 6 '10 at 9:49
No they worked actually, thanks! – Pablo Sep 6 '10 at 23:33
Even if you try to delete files in the mounted folder as root? – user39559 Sep 7 '10 at 12:34

For a long time after bind mounts were introduced, the kernel associated mount options with devices rather than mount points, end of story. When you ran mount --bind, the kernel silently ignored all options since they couldn't be applied just to the bind mount.

Starting with kernel 2.6.26 (or earlier for distributions that patched the upstream kernel), bind mounts have a read-only status that is separate from the original mount. So read-only bind mounts do work. However, the support is not perfect, for example the kernel still ignores options passed to mount --bind. You can make a read-only bind mount by making a bind mount and mounting it read-only. This introduces a security problem in some scenarios (there is a small window of time during which the bind mount is writable).

Debian lenny has a patched 2.6.26 kernel that makes mount --bind -r create a read-only bind mount atomically. Ubuntu 10.04 doesn't include that patch.

The fuse filesystem bindfs generalizes the effect of mount --bind. It supports read-only bind mounts and many other permission and ownership changes. It is not fully equivalent to mount --bind, however. For example, reading from a read-only bind mount never updates the access time of a file, but might for a bindfs -p a-w fuse mount.

share|improve this answer
thanks for being so descriptive, it's good to know all that! – Pablo Sep 6 '10 at 23:34
+1 for explaining so well. – user39559 Sep 7 '10 at 12:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .