I use mount -o bind to mount directories inside chroots, which works really well. The problem is that I'd like some of these bind-mounted directories to be read only in chroot.

Is it possible? If not - any other way to achieve it?

I was thinking about using NFS for localhost mounts, but it looks like overkill.

link|improve this question

74% accept rate
feedback

2 Answers

up vote 3 down vote accepted

Accourding to this is it is possible. You do need a recent kernel.

link|improve this answer
Thanks. Mount + remount fixed it. – depesz Apr 28 '10 at 7:51
feedback

Direct answer from the LWN article:

mount --bind /vital_data /untrusted_container/vital_data
mount -o remount,ro /untrusted_container/vital_data

Supported since Linux 2.6.26.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.