Re: Dynamically mount shares
Op zo, 10-12-2006 te 17:47 +0100, schreef Koen Vermeer:
> > autofs should be able to do that. You can define custom mount options,
> > if you want.
> Sure, but how do I define these custom mount options, on a per-user
> basis? For user a, it should look in /home/a/.cifscredentials, and for
> user b, it should look in /home/b/.cifscredentials. Do you know of any
> example that does this, or something close?
It seems like I've got it to work. It needs more testing, but I guess
the rest is fine-tuning. This is the setup:
# /etc/auto.master
/automnt /etc/auto.automnt
# /etc/auto.automnt
* -fstype=autofs,-Duser=& file:/etc/auto.automntuser
# /etc/auto.automntuser
* -fstype=cifs,otheroptions,credentials=/home/${user}/.cifscredentials
hostname:/&
This means that /automnt/johndoe/sharename will mount
hostname:/sharename with the credentials
file /home/johndoe/.cifscredentials. I then simply created some links
from the users home directories to these /automnt-directories, et voila!
I can add another layer such that the host is also in the path
(e.g., /automnt/johndoe/hostname/sharename), but in my setup, there's
only one host anyway.
Koen
Reply to: