* How do I mount a file system for root access only?
@ 2002-05-23 19:55 Dan
2002-05-23 21:35 ` Michael Heiming
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Dan @ 2002-05-23 19:55 UTC (permalink / raw)
Greetings!
I should probably know the answer to this but I seem to have a mental
block at the moment.
I have a script, which runs periodically to copy some files from one
system to a mount point on another system. It first creates a mount
point, mounts a file system to it, copies the files to the mounted
file system, unmounts the file system, and then removes the mount
point.
It has been running great except once in a while, I get a nosey user
who does something to make the file system busy. When the script
finishes running and it is time to unmount the file system, the nosey
user causes the script to generate an error when the script tries to
unmount the file system because the file system is now busy.
Is there any way to mount the file system so that root is the only one
who has access to it?
I have a work around by "chmod 700" the mount point/file system after
the mount but I am wondering if there is a better way. Between the
time I mount it and do the chmod, there is a possibility that the user
could get in there and make it busy.
Thanks for any ideas!
Dan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I mount a file system for root access only?
2002-05-23 19:55 How do I mount a file system for root access only? Dan
@ 2002-05-23 21:35 ` Michael Heiming
2002-05-24 12:33 ` Dan
2002-05-24 3:43 ` Stuart Fuller
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Michael Heiming @ 2002-05-23 21:35 UTC (permalink / raw)
Dan (<ffb05a35.0205231155.1865bddb@posting.google.com>):
> Greetings!
>
> I should probably know the answer to this but I seem to have a
> mental block at the moment.
>
> I have a script, which runs periodically to copy some files from
> one
> system to a mount point on another system. It first creates a
> mount point, mounts a file system to it, copies the files to the
> mounted file system, unmounts the file system, and then removes
> the mount point.
A little bit beyond me, why you are doing this...
> It has been running great except once in a while, I get a nosey
> user
> who does something to make the file system busy. When the script
> finishes running and it is time to unmount the file system, the
> nosey user causes the script to generate an error when the script
> tries to unmount the file system because the file system is now
> busy.
Perhaps, all the user did was 'cd /mountpoint'.
> Is there any way to mount the file system so that root is the only
> one who has access to it?
>
> I have a work around by "chmod 700" the mount point/file system
> after
> the mount but I am wondering if there is a better way. Between
> the time I mount it and do the chmod, there is a possibility that
> the user could get in there and make it busy.
Create the mountpoint with perms 700 before you mount it?
Or use 'fuser' or 'lsof'(if you have it) and log the user out from
your script, before you umount...;-)
Michael Heiming
--
Remove the +SIGNS case mail bounces.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I mount a file system for root access only?
2002-05-23 19:55 How do I mount a file system for root access only? Dan
2002-05-23 21:35 ` Michael Heiming
@ 2002-05-24 3:43 ` Stuart Fuller
2002-05-24 12:34 ` Dan
2002-05-24 12:42 ` Joerg Bruehe
2002-05-24 12:59 ` Peter da Silva
3 siblings, 1 reply; 8+ messages in thread
From: Stuart Fuller @ 2002-05-24 3:43 UTC (permalink / raw)
Dan wrote:
> Greetings!
>
> I should probably know the answer to this but I seem to have a mental
> block at the moment.
>
> I have a script, which runs periodically to copy some files from one
> system to a mount point on another system. It first creates a mount
> point, mounts a file system to it, copies the files to the mounted
> file system, unmounts the file system, and then removes the mount
> point.
>
> It has been running great except once in a while, I get a nosey user
> who does something to make the file system busy. [...]
The appropriate use of a hammer to the user's fingers will take care of it.
Stu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I mount a file system for root access only?
2002-05-23 21:35 ` Michael Heiming
@ 2002-05-24 12:33 ` Dan
0 siblings, 0 replies; 8+ messages in thread
From: Dan @ 2002-05-24 12:33 UTC (permalink / raw)
Michael Heiming <michael+USENET@heiming.de> wrote in message news:<ebnjca.rar.ln@charon.heiming.de>...
> Dan (<ffb05a35.0205231155.1865bddb@posting.google.com>):
>
> > Greetings!
> >
> > I should probably know the answer to this but I seem to have a
> > mental block at the moment.
> >
> > I have a script, which runs periodically to copy some files from
> > one
> > system to a mount point on another system. It first creates a
> > mount point, mounts a file system to it, copies the files to the
> > mounted file system, unmounts the file system, and then removes
> > the mount point.
>
> A little bit beyond me, why you are doing this...
Ofcourse. I didn't explain why I was doing it. :-)
>
> > It has been running great except once in a while, I get a nosey
> > user
> > who does something to make the file system busy. When the script
> > finishes running and it is time to unmount the file system, the
> > nosey user causes the script to generate an error when the script
> > tries to unmount the file system because the file system is now
> > busy.
>
> Perhaps, all the user did was 'cd /mountpoint'.
Or a 'find /mountpoint -name something', or who knows....
>
> > Is there any way to mount the file system so that root is the only
> > one who has access to it?
> >
> > I have a work around by "chmod 700" the mount point/file system
> > after
> > the mount but I am wondering if there is a better way. Between
> > the time I mount it and do the chmod, there is a possibility that
> > the user could get in there and make it busy.
>
> Create the mountpoint with perms 700 before you mount it?
> Or use 'fuser' or 'lsof'(if you have it) and log the user out from
> your script, before you umount...;-)
>
> Michael Heiming
What the heck! I know I tried this yesterday and it did NOT work as I
expected it to. I was really baffeled as to why. I was about to
write a response and tried it again to make sure I documented exactly
what was happeneing and it works just as I would expect it to. I must
have fat-fingered something. :-((
Thanks for your response though!!!!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I mount a file system for root access only?
2002-05-24 3:43 ` Stuart Fuller
@ 2002-05-24 12:34 ` Dan
0 siblings, 0 replies; 8+ messages in thread
From: Dan @ 2002-05-24 12:34 UTC (permalink / raw)
Stuart Fuller <stufuller@usa.net> wrote in message news:<qvckca.2pk.ln@dadsys1.fuller.local>...
> Dan wrote:
>
> > Greetings!
> >
> > I should probably know the answer to this but I seem to have a mental
> > block at the moment.
> >
> > I have a script, which runs periodically to copy some files from one
> > system to a mount point on another system. It first creates a mount
> > point, mounts a file system to it, copies the files to the mounted
> > file system, unmounts the file system, and then removes the mount
> > point.
> >
> > It has been running great except once in a while, I get a nosey user
> > who does something to make the file system busy. [...]
>
> The appropriate use of a hammer to the user's fingers will take care of it.
>
> Stu
That thought crossed my mind!!!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I mount a file system for root access only?
2002-05-23 19:55 How do I mount a file system for root access only? Dan
2002-05-23 21:35 ` Michael Heiming
2002-05-24 3:43 ` Stuart Fuller
@ 2002-05-24 12:42 ` Joerg Bruehe
2002-05-24 12:59 ` Peter da Silva
3 siblings, 0 replies; 8+ messages in thread
From: Joerg Bruehe @ 2002-05-24 12:42 UTC (permalink / raw)
Hi!
Dan wrote:
>
> [...]
>
> I have a script, which runs periodically to copy some files from one
> system to a mount point on another system. It first creates a mount
> point, mounts a file system to it, copies the files to the mounted
> file system, unmounts the file system, and then removes the mount
> point.
Assuming the name of the mount point does not change:
Create that directory once, with appropriate ownership and permission.
Create some file in there, just with a name: "NOT_MOUNTED__KEEP_OFF".
This prevents others from creating it and serves as documentation.
>
> It has been running great except once in a while, I get a nosey user
> who does something to make the file system busy. [...]
>
> Is there any way to mount the file system so that root is the only one
> who has access to it?
In my 4.0D manuals of "fstab" and "mount", I found none.
>
> I have a work around by "chmod 700" the mount point/file system after
> the mount but I am wondering if there is a better way. Between the
> time I mount it and do the chmod, there is a possibility that the user
> could get in there and make it busy.
If you never recreate the filesystem itself, a "chown" / "chmod"
done while it is mounted will also be effective at the next mount,
so after the initial change there is no time window for that user.
In the mounted state, the owner / permission of the file system's
root directory do matter, that of the mount point are irrelevant.
HTH,
Joerg Bruehe
--
Joerg Bruehe, SQL Datenbanksysteme GmbH, Berlin, Germany
(speaking only for himself)
mailto: joerg@sql.de
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I mount a file system for root access only?
2002-05-23 19:55 How do I mount a file system for root access only? Dan
` (2 preceding siblings ...)
2002-05-24 12:42 ` Joerg Bruehe
@ 2002-05-24 12:59 ` Peter da Silva
2002-05-24 18:39 ` Dan
3 siblings, 1 reply; 8+ messages in thread
From: Peter da Silva @ 2002-05-24 12:59 UTC (permalink / raw)
In article <ffb05a35.0205231155.1865bddb@posting.google.com>,
Dan <daniel.j.botz@cummins.com> wrote:
> Is there any way to mount the file system so that root is the only one
> who has access to it?
Mount it beneath a directory that only root has access to. EG:
mkdir /private
chmod 700 /private
mkdir /private/mnt
mount $device /private/mnt
--
I've seen things you people can't imagine. Chimneysweeps on fire over the roofs
of London. I've watched kite-strings glitter in the sun at Hyde Park Gate. All
these things will be lost in time, like chalk-paintings in the rain. `-_-'
Time for your nap. | Peter da Silva | Har du kramat din varg, idag? 'U`
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: How do I mount a file system for root access only?
2002-05-24 12:59 ` Peter da Silva
@ 2002-05-24 18:39 ` Dan
0 siblings, 0 replies; 8+ messages in thread
From: Dan @ 2002-05-24 18:39 UTC (permalink / raw)
peter@abbnm.com (Peter da Silva) wrote in message news:<acldfs$lqs@web.eng.baileynm.com>...
> In article <ffb05a35.0205231155.1865bddb@posting.google.com>,
> Dan <daniel.j.botz@cummins.com> wrote:
> > Is there any way to mount the file system so that root is the only one
> > who has access to it?
>
> Mount it beneath a directory that only root has access to. EG:
>
> mkdir /private
> chmod 700 /private
> mkdir /private/mnt
> mount $device /private/mnt
Thanks everyone for your input!!!
Peter: Thats a nice and easy way to do it. I don't know why I didn't
think of that!
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-05-24 18:39 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-23 19:55 How do I mount a file system for root access only? Dan
2002-05-23 21:35 ` Michael Heiming
2002-05-24 12:33 ` Dan
2002-05-24 3:43 ` Stuart Fuller
2002-05-24 12:34 ` Dan
2002-05-24 12:42 ` Joerg Bruehe
2002-05-24 12:59 ` Peter da Silva
2002-05-24 18:39 ` Dan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox