LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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 08-28-2006, 01:18 PM   #1
kramer2718
Member
 
Registered: Jul 2006
Posts: 46

Rep: Reputation: 15
Mount bind read-only


I have the following lines in my fstab:

/dev/sdb1 /mnt/3 reiserfs auto,user,noatime 0 0
/mnt/3 /home/ftp none bind,ro

I was hoping to be able to be able to mount /dev/sdb1 for reading writing through /mnt/3 and for reading only through /home/ftp. Unfortunately, it doesn't work. After mount, I have rw access to both. After, googling, I came across some discussion that this functionality is being added to the kernel, but the discussion was a bit technical for me.

Does anyone know anything about this?
 
Old 08-28-2006, 01:55 PM   #2
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
Take out the '/mnt/3 /home/ftp none bind,ro' from /etc/fstab; that will not work. Instead use:

mount --bind -r /mnt/3 /home/ftp

This will allow you to mount /home/ftp as read-only.
 
Old 08-28-2006, 03:07 PM   #3
kramer2718
Member
 
Registered: Jul 2006
Posts: 46

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by ramram29
mount --bind -r /mnt/3 /home/ftp

Nope. I still have write access to /home/ftp.
 
Old 08-28-2006, 03:28 PM   #4
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
Look in your FTP configuration and make sure that you are not allowing write/upload/modify access - vsftp is very good with this. Look in /usr/share/doc/vsftpd/EXAMPLES for more examples.

You may also want to change permissions for the /home/ftp folder with something like:

chown -R root:root /home/ftp
chmod -R 0755 /home/ftp
 
Old 08-28-2006, 04:43 PM   #5
kramer2718
Member
 
Registered: Jul 2006
Posts: 46

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by ramram29
Look in your FTP configuration and make sure that you are not allowing write/upload/modify access - vsftp is very good with this. Look in /usr/share/doc/vsftpd/EXAMPLES for more examples.

You may also want to change permissions for the /home/ftp folder with something like:

chown -R root:root /home/ftp
chmod -R 0755 /home/ftp
Those are good points but this isn't really an ftp issue. I don't even have an ftp daemon running right now. I was hoping to get the directory to mount as read only while still being read-write when mounted as another directory. This is because I'm going to chroot into /home.

In general it would be nice to be able to mount partitions with different read-write permissions depending on where they are mounted.

I.e. mount --bind -r dir1 dir2

should not allow write access to dir2 no matter the mount permissions of dir1.
 
Old 08-28-2006, 04:49 PM   #6
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 117Reputation: 117
As far as I can tell, the functionality you seek should be coming shortly, but is not yet in the stable kernel.
 
Old 08-29-2006, 07:43 AM   #7
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
I thought '--bind -r' would work but you are right - it does not make it read only. I never tried it before but now that I tested this it does not mount it read only but rather it ignores the read-only parameter.
 
Old 08-30-2008, 10:44 AM   #8
MONK
LQ Newbie
 
Registered: Aug 2008
Posts: 2

Rep: Reputation: 0
Does anyone know if this has been fixed yet as I really need this functionality?
 
Old 08-30-2008, 04:03 PM   #9
jarfil
LQ Newbie
 
Registered: Mar 2008
Posts: 2

Rep: Reputation: 0
More info: http://lwn.net/Articles/281157/

Seems like this should be in kernel 2.6.26, with some enhancements afterwards. Meanwhile, a workaround might be to export a local nfs share as read-only.
 
Old 08-31-2008, 10:14 AM   #10
MONK
LQ Newbie
 
Registered: Aug 2008
Posts: 2

Rep: Reputation: 0
Good idea, guess I can just mount them as read only instead.

It appears I'm not the only person who has had this problem, I have also stuck a post on the ubuntu forums about it.

http://ubuntuforums.org/showthread.p...32#post5699832
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
apache and mount bind sciguy125 Linux - Software 0 05-20-2006 12:51 AM
mount/bind to folder with space in name magnum81 Linux - Software 2 04-30-2006 01:39 PM
persistent mount --bind linuxnube Linux - Software 0 05-12-2004 08:24 PM
mount --bind on boot tp6400 Linux - Newbie 1 01-25-2004 09:41 PM
kernel panic unable to mount root (yes ive read/read other posts) dmx9595 Linux - General 4 01-17-2004 05:07 AM


All times are GMT -5. The time now is 08:04 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration