Re: Auto.net syntax.

From: Dr Balwinder Singh Dheeman (bsd.sanspam_at_cto.homelinux.net)
Date: 11/11/04


Date: Thu, 11 Nov 2004 09:27:55 +0530


On 11/10/04 20:16, George wrote:
> I've searched through many old records on auto.net, but can't quite
> find the one hit that helps.
>
> I have a number of Unix flavors on the network and all are happy
> either with a +auto.master, +auto_master, or their own auto_master (or
> .) file. Either way, the contents of the NIS server file or the
> client file basically includes:
>
> /net -hosts -intr,nosuid,nobrowse. (give or take a parameter)
>
> The Linux system does not respond to the /net entry from the master.
> Perhaps it is just a syntax difference, not sure. I have been working
> with this Linux systems local auto.master and have the following:
>
> /net file:auto.net -intr,nosuid,nodev,rw,soft
>
> That seems ok. The only glitch I am having is in the auto.net file. I
> have it partially working with:
>
> osprey -rw,soft,intr osprey:/local/disk1
>
> Osprey exports /local/disk1 and I can get to it via cd /net/osprey.
> What I CAN'T figure out is out to setup auto.net so that if I cd
> /net/osprey I see ALL its exported(shared) file systems as is the case
> with the other systems using the NIS /net or their local /net entry.
> For example if I log into the SGI system raven and cd /net/osprey I
> see all osprey's (a Solaris system) shared files systems and from
> there cd into the subdirectory of my choosing. I have been trying to
> work with the * and the & wildcards, but have not hit upon the correct
> combo yet.
>
> Any ideas or suggestions would be most valuable.

On my Knoppix I found a wroking copy of an auto.net (see attatchments)
and even created an auto.smb for samba shares based on auto.net ideas.
both of these are working for me.

The $HOME/.sambarc should contain:

username=sambausername
password=sambapassword

One thing more, you need to install latest autofs and mount packages.

HTH.

-- 
Dr Balwinder Singh Dheeman            Registered Linux User: #229709
CLLO (Chief Linux Learning Officer)   Machines: #168573, 170593, 259192
Anu's Linux@HOME                      Distros: Knoppix, Fedora, FreeBSD
More: http://anu.homelinux.net/~bsd/  Visit: http://counter.li.org/

# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(5).

# KNOPPIX automounts for floppy and cdrom(s), see knoppix-autoconfig
/mnt/auto /etc/automount.sh --timeout=20

/var/autofs/misc /etc/auto.misc --timeout=30
/var/autofs/net /etc/auto.net --timeout=20
/var/autofs/smb /etc/auto.smb --timeout=20



#!/bin/sh

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

# Look at what an 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
# Note: "nonstrict" is now set by default, remove it if you don't want it.
opts="-fstype=nfs,users,hard,intr,nonstrict"

# 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="/sbin/showmount --no-headers -e $key"

$SHOWMOUNT | LC_ALL=C 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 }
        '



#!/bin/sh

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

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

key="$1"

# FIXME: Override a bug/feature in autofs; it's working for only me, but is
# genric enough to be usable by others
[ -z "$HOME" ] || HOME="/home/bsd"

# Get username from $HOME/.sambarc
usr=`awk -F= '/username/ {print $2}' $HOME/.sambarc`

# Add/edit other applicable smbfs/mount options here.
# Note: "nonstrict" is now set by default, remove it if you don't want it.
opts="-fstype=smb,credentials=$HOME/.sambarc,uid=$usr,gid=$usr,fmask=664,dmask=775,nonstrict"

# List samba/windows/lan manager shares available on target host (key).
LISTMOUNTS="/usr/bin/smbclient -A $HOME/.sambarc -L $key"

$LISTMOUNTS | LC_ALL=C sort +0 | \
        awk -v key="$key" -v opts="$opts" -- '
        BEGIN { ORS=""; first=1 }
                { if (first) { print opts; first=0 };
                  if ($2 == "Disk") {print " \\\n\t" "/mnt/" $1, "//" key "/" $1 }}
        END { if (!first) print "\n"; else exit 1 }
        ' | grep -v '\$'