My following remarks are untested and unverified ...
 and I have more experience with Linux than with Solarsis.


On Thu, 6 May 2010 17:43:09 -0500
Michael Jinks <[email protected]> wrote:

> [getting a bit OT for Sun Ray, but the thread started here so...]
> 
> Okay, I remember now why I didn't use an executable map to begin with; I
> can't figure out how to call it for our setup.
> 
> Our home directories live on an NFS server, as individual per-user ZFS
> filesystems, and we use the automounter to mount the shares.  So we
> already have entries in auto_master which look something like:
> 
>   /nfs/path/to/home0  /etc/auto.nfs.map       -nobrowse
> 
> Those homes don't exist on the server by default; the plan is to create
> them the first time a user logs in, export them, and then let the
> automounter do its usual thing.  We have the logic for that all worked
> out, and we want to call the script which triggers the home
> create-and-export process on the server during user login.
> 
> The examples I've found for executable maps seem to assume that
> either we mount the directory from nfs, OR we create it locally; I don't
> see any use cases where we would both call an executable map and manage
> a directory using the automounter.  Would I just add the executable map
> alongside the existing map?  Say, alter the above to the following?
> 
>   /nfs/path/to/home0  /etc/auto_home_create.sh
>   /nfs/path/to/home0  /etc/auto.nfs.map       -nobrowse
> 
> This seems ambiguous.

I think this doesn't work. You can only have one map. But I don't see
the problem. The executable map is expected to write to stdout
the automount map line which is *then* executed by the automounter.
So your script can start a script on the NFS server, which creates
the home when necessary and exports the home and then it returns the
automount map to the local autofs daemon.
Perhaps timing can be a problem, I don't know who long autofs waits for the 
executable script 
to come round with an automount map entry.


> 
> Also, how do I pass an argument to my executable map to tell the server
> which directory to create?  In PAM, we have tokens like "%u" which
> expand to the user name being authenticated; is there some similar
> facility in the automounter?  In the example Meik linked, I see:
> 
>   hdir=$(echo ~$1)
> 
> This implies that the executable map is called with the authenticating
> user name as $1, is that the case?


Yes, the executable map is called with one argument, the "key" to 
the automount mapping table.  For homes it is the user name.

I have an ugly hack on one of my installations. Users can automount their 
webspace by "cd /www/username". On the distant web server, the users are
unknown and all files belong to some www-user. Both machimes are running Linux.
The trick is to use Samba. Samba allows to  mount CIFS-exported filesystems 
with arbitrary uids.  So the web server is also a samba server exporting the 
web 
spaces. The other machines (where the users can log in) have an 
executable auto_www map which looks like

#!/bin/bash
name=$1
u=`id -u $name`
g=`id -g $name`
echo "-fstype=cifs,rw,guest,dir_mode=0700,uid=$u,gid=$g ://webserver/$name"


No, I am not proud of this -:)

--  Meik



-- 
Meik Hellmund
Mathematisches Institut, Uni Leipzig
e-mail: [email protected]
http://www.math.uni-leipzig.de/~hellmund

_______________________________________________
SunRay-Users mailing list
[email protected]
http://www.filibeto.org/mailman/listinfo/sunray-users

Reply via email to