Hi,

for quite some time I have been trying to get the automounter working with a 
program map, i.e. a shell script that returns the available mounts of the 
remote host as mount points on the local machine. I tried the script that 
comes with the autofs package, but  the following happens (excerpts from the 
/var/log/messages):

Nov 29 12:00:58 myhost automount[8760]: starting automounter version 4.0.0, 
path= /net, maptype = program, mapname = /etc/auto.net

Nov 29 12:00:58 myhost automount[8760]: using kernel protocol version 3
Nov 29 12:00:58 myhost automount[8760]: using timeout 300 seconds; freq 75 
secs
Nov 29 12:01:06 myhost automount[8760]: attempting to mount entry 
/net/remotehost
Nov 29 12:01:06 myhost automount[8766]: mount(bind): mkdir_path 
/net/remotehost/export/dk1 failed: Operation not permitted
                                ^^^^^^^^^^^^^^^^^^^^^

The remotehost exports the partition /export/dk1

The /etc/auto.master on myhost looks like:
/net   /etc/auto.net

And /etc/auto.net on myhost looks like:
---snip------
#!/bin/sh

# $Id: //depot/autofs-4.0/samples/auto.net#6 $

# Look at what a host is exporting to determine what we can mount.
# This is very simple, but it appears to work surprisingly well

key="$1"

# add "nosymlink" here if you want to suppress symlinking local filesystems
# add "nonstrict" to make it OK for some filesystems to not mount
opts="-fstype=nfs,hard,intr,nodev,nosuid,nonstrict,rsize=8192,wsize=8192"

# Showmount comes in a number of names and varieties.  "showmount" is
# typically an older version which accepts the '--no-headers' flag
# but ignores it.  "kshowmount" is the newer version installed with knfsd,
# which both accepts and acts on the '--no-headers' flag.
#SHOWMOUNT="kshowmount --no-headers -e $key"
#SHOWMOUNT="showmount -e $key | tail +2"

# Newer distributions get this right
SHOWMOUNT="/usr/lib/autofs/showmount --no-headers -e $key"

$SHOWMOUNT | sort +0 | \
        awk -v key="$key" -v opts="$opts" -- '
        BEGIN           { ORS=""; first=1 }
                        { if (first) { print opts; first=0 }; print " \\\n\t" 
$1
, key ":" $1 }
        END             { if (!first) print "\n"; else exit 1 }
        '
----snap-----------

It is marked as executable. It also returns the mounts available, but this 
failed mkdir_path is the anoying thing.

I am running Linux myhost 2.4.9 #1 

Your help is much appreciated!

Thank you.

Hauke

Reply via email to