Autofs Configuration Files

From Nuclear Physics Group Documentation Pages
Revision as of 18:41, 8 June 2007 by Steve (talk | contribs) (Contents of autofs config files)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

These are the configuration files needed in /etc/ in order for users' home directories to get mounted on a client. Some of these files may not be necessary! This should be researched. At the very least, auto.master and auto.net are needed.

auto.master

#
# $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
#/misc	/etc/auto.misc
#/net	-hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
#+auto.master
#
# This is *not* the default /etc/auto.net
/net	/etc/auto.net

auto.misc.dist

#
# $Id: auto.misc,v 1.2 2003/09/29 08:22:35 raven Exp $
#
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage 

cd		-fstype=iso9660,ro,nosuid,nodev	:/dev/cdrom

# the following entries are samples to pique your imagination
#linux		-ro,soft,intr		ftp.example.org:/pub/linux
#boot		-fstype=ext2		:/dev/hda1
#floppy		-fstype=auto		:/dev/fd0
#floppy		-fstype=ext2		:/dev/fd0
#e2floppy	-fstype=ext2		:/dev/fd0
#jaz		-fstype=ext2		:/dev/sdc1
#removable	-fstype=ext2		:/dev/hdd

auto.net

#!/bin/sh

# This script overrides the default distribution-provided /etc/auto.net,
# retaining support for our custom namespaces while still allowing the
# wildcard functionality.  E.g. /net/data/taro and /net/taro/data are
# interchangable.  Paths such as /net/data/wheel and /net/www/physics
# are still preferred over explicit paths as the host providing such
# services may change at a future date. 

case "$1" in
	data)
		echo -fstype=autofs ldap:nisMapName=auto.data,ou=Automount,dc=physics,dc=unh,dc=edu
		;;
	home)
		echo -fstype=nfs,hard,intr,nodev,nosuid einstein:/home
		;;
	www)
		echo -fstype=autofs ldap:nisMapName=auto.www,ou=Automount,dc=physics,dc=unh,dc=edu
		;;
	null)
		echo -fstype=autofs ldap:nisMapName=auto.null,ou=Automount,dc=physics,dc=unh,dc=edu
		;;
	.home)
		echo -fstype=autofs userhome 
		;;
	*)
		/etc/auto.net.dist "$1"
		;;
esac

auto.net.dist

#!/bin/sh

# $Id: auto.net,v 1.6 2005/01/04 14:36:54 raven Exp $

# This file must be executable to work! chmod 755!

# 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"

# 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 -n +2"

# I've wanted to do this for ages.
# Taken from a script contributed by Elmar Pruesse for
# mounting smb mounts.
for SMNT in /{,usr/}{,s}bin/{,k}showmount
do
	if [ -x $SMNT ]
	then
		break
	fi
done

[ -x $SMNT ] || exit 1

# Newer distributions get this right
SHOWMOUNT="$SMNT --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 }
	'