FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 04-25-2008, 04:33 PM
Chris
 
Default prevent writing to unmounted directory

On Friday 25 April 2008, Damon L. Chesser wrote:
> Chris wrote:
> > that seems like a nice approach. Why do I need to touch the SENTINEL
> > file?
> >
> > C
>
> Chris,
>
> in the example, you touch the file ONCE to make it exist. Then when you
> mount music, it will "mask" the file. That file will only show up when
> your smb mount for music is not mounted. Try it.
>
> When you make a file in a dir /tmp/test then mount something in
> /tmp/test the contents of /tmp/test will only show the mounted files.
> When you unmount /tmp/test the original file will still be there.
>
> I think this is a rather elegant approach independent of networking. If
> networking is down, you will see the "touched" file. If networking is
> up and smb/CIF is working, you will not see it. The "touched" file will
> not be overwritten by your file moving/deletion/backups/restores.
>
> Does that help?

Yes! Thank you very much!

>
> --
> Damon L. Chesser
> damon@damtek.com
> http://www.linkedin.com/in/dchesser



--
C. Hurschler


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 05-10-2008, 05:54 AM
Sean Connor
 
Default prevent writing to unmounted directory

Chris <list.hurschler@gmx.de> writes:

> I want to run a script to rsync local files to a NAS mounted to /mnt/music.
> Sometimes the NAS is not running, and I want to prevent the script from
> writing to the mount directory: is there any easy way to prevent this?

Umount /mnt/music. Run "chattr +i /mnt/music", or, if rsync
doesn't run as root, "chmod o-w /mnt/music".

This doesn't prevent writes to existing files under the
mount directory, or to any file in any existing
subdirectory of the mount directory.

The immutable flag will become unset on /mnt/music when it's
mounted, and the permissions and ownership and so on will
match those of the root of the filesystem being mounted.

Example:

/tmp# dd if=/dev/zero of=loopfs.img count=400
400+0 records in
400+0 records out
204800 bytes (205 kB) copied, 0.00501796 s, 40.8 MB/s
/tmp# mke2fs -Fq loopfs.img
/tmp# mkdir loopdir
/tmp# chattr +i loopdir
/tmp# touch loopdir/foo
touch: cannot touch `loopdir/foo': Permission denied
/tmp# lsattr -d loopdir
----i------------- loopdir
/tmp# mount -o loop loopfs.img loopdir
/tmp# touch loopdir/foo
/tmp# lsattr -d loopdir
------------------ loopdir

--
sean
sconnor@spacey.net


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 03:53 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org