LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-29-2007, 01:48 PM   #1
sauce
Member
 
Registered: Oct 2005
Distribution: Slackware, Ubuntu
Posts: 52

Rep: Reputation: 15
Mirroring a directory as read-only (mount --bind, kind of)


Here is the scenario: there is a directory for FTP that users can write to, and then a "mirrored" directory (using mount --bind) that web users can read. There is absolutely no reason that the web users would ever need to write to this directory, so for security reasons I would like to set it to read-only. Unfortunately it seems mounting the directory as read-only (ro) is ineffective when used in combination with --bind.

let me show you the 2 mounts I speak of:
Code:
/dev/md/0 on /mnt/data type ext3 (rw)
/mnt/data on /var/www/htdocs/main/data type none (ro,bind)
See how it says ro,bind? the "ro" is useless, but I put it there anyway.

The only other idea I have is to use samba to create a share, and then use smbmount to mount it as read-only with smbfs, but how incredibly inefficient is that ?
 
Old 12-29-2007, 03:08 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
I think that you are confused about what --bind does. When you do the second mount you still only have one copy of the data. You just have two different paths to access the single copy of the data. Your second mount is just creating a second path to the data. It is not replicating the data.

What you need is some way of creating a backup copy of the data in a location where the users cannot update the second copy.

-------------------
Steve Stites
 
Old 12-30-2007, 01:25 PM   #3
sauce
Member
 
Registered: Oct 2005
Distribution: Slackware, Ubuntu
Posts: 52

Original Poster
Rep: Reputation: 15
oh i'm not confused, i know exactly what it does. i think you are confused about what i am asking

still waiting on some comments..
 
Old 01-06-2008, 07:23 PM   #4
xptools
Member
 
Registered: Sep 2005
Location: Canada
Distribution: Debian Testing
Posts: 40

Rep: Reputation: 15
Quote:
Originally Posted by slackk View Post
it seems mounting the directory as read-only (ro) is ineffective when used in combination with --bind.
Interesting, didn't know that before.

Then maybe just bind mount rw, then use the traditional way of controlling write access and directory protection -- setup the upload directory write access only to ftp, all other users read only access, by setting up proper group and directory & file modes.
 
Old 01-29-2008, 03:14 PM   #5
sauce
Member
 
Registered: Oct 2005
Distribution: Slackware, Ubuntu
Posts: 52

Original Poster
Rep: Reputation: 15
Timing is everything. 2.6.24 was released this week and in the changes, I noticed this feature was added. Can't figure out how to use it though. Not as easy as just mounting read-only, I guess. Maybe a kernel change. Anyone know?
 
Old 01-30-2008, 04:06 AM   #6
ComputerGreek
Member
 
Registered: Sep 2007
Posts: 152

Rep: Reputation: 30
Note that when you use with --bind, the filesystem mount options remain the same as those on the original mount point.

They cannot be changed by passing the -o option along with --bind.

That is why the ro is ignored.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mount bind read-only kramer2718 Linux - General 9 08-31-2008 10:14 AM
Mirroring Fedora Directory Server (FC3,FC4) gyankosh Linux - Software 1 09-27-2005 10:20 AM
Directory/folder mirroring utility? paulsh2k4 Linux - Software 2 09-14-2004 02:44 PM
Directory mirroring? Narooze Linux - Software 2 07-01-2004 08:51 AM
rync (mirroring a directory) bkeating Programming 2 06-25-2003 05:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration