cat /etc/auto_home
#!/usr/bin/sh
AUTO_USER=${1} # parameter passed by automounter
HOMEDIRPATH='/home' # automounted homedirectory location
PHYSICALDIRPATH='/export/home' # physical homedirectory location
## Get user information from /etc/passwd
PW_LINE=`grep "^${AUTO_USER}:" /etc/passwd`
PW_UID=`echo ${PW_LINE} | cut -d : -f 3`
PW_GID=`echo ${PW_LINE} | cut -d : -f 4`
PW_HOME=`echo ${PW_LINE} | cut -d : -f 6`
## If user doesn't exist in /etc/passwd, skip the automount and homedir creation
if [ -z "${PW_UID}" ]; then
exit 0
fi
## Only automount directories if homedir of the user is set to /home (HOMEDIRPATH)
if [ "${PW_HOME}" != "${HOMEDIRPATH}/${AUTO_USER}" ]; then
exit 0
fi
## Create homedirectory if non-existent
## - make directory in physical location
## - copy contents of /etc/skel
## - set default permissions
## - set ownership to the user (and primary group)
if [ ! -d ${PHYSICALDIRPATH}/${AUTO_USER} ]; then
/usr/bin/mkdir -p ${PHYSICALDIRPATH}/${AUTO_USER}
/usr/bin/cp /etc/skel/.??* ${PHYSICALDIRPATH}/${AUTO_USER}
/usr/bin/cp /etc/skel/* ${PHYSICALDIRPATH}/${AUTO_USER}
/usr/bin/chmod 755 ${PHYSICALDIRPATH}/${AUTO_USER}
/usr/bin/chown -R ${PW_UID}:${PW_GID} ${PHYSICALDIRPATH}/${AUTO_USER}
fi
## tell automount which path to 'automount'
echo "localhost:${PHYSICALDIRPATH}/${AUTO_USER}"
exit
#!/usr/bin/sh
AUTO_USER=${1} # parameter passed by automounter
HOMEDIRPATH='/home' # automounted homedirectory location
PHYSICALDIRPATH='/export/home' # physical homedirectory location
## Get user information from /etc/passwd
PW_LINE=`grep "^${AUTO_USER}:" /etc/passwd`
PW_UID=`echo ${PW_LINE} | cut -d : -f 3`
PW_GID=`echo ${PW_LINE} | cut -d : -f 4`
PW_HOME=`echo ${PW_LINE} | cut -d : -f 6`
## If user doesn't exist in /etc/passwd, skip the automount and homedir creation
if [ -z "${PW_UID}" ]; then
exit 0
fi
## Only automount directories if homedir of the user is set to /home (HOMEDIRPATH)
if [ "${PW_HOME}" != "${HOMEDIRPATH}/${AUTO_USER}" ]; then
exit 0
fi
## Create homedirectory if non-existent
## - make directory in physical location
## - copy contents of /etc/skel
## - set default permissions
## - set ownership to the user (and primary group)
if [ ! -d ${PHYSICALDIRPATH}/${AUTO_USER} ]; then
/usr/bin/mkdir -p ${PHYSICALDIRPATH}/${AUTO_USER}
/usr/bin/cp /etc/skel/.??* ${PHYSICALDIRPATH}/${AUTO_USER}
/usr/bin/cp /etc/skel/* ${PHYSICALDIRPATH}/${AUTO_USER}
/usr/bin/chmod 755 ${PHYSICALDIRPATH}/${AUTO_USER}
/usr/bin/chown -R ${PW_UID}:${PW_GID} ${PHYSICALDIRPATH}/${AUTO_USER}
fi
## tell automount which path to 'automount'
echo "localhost:${PHYSICALDIRPATH}/${AUTO_USER}"
exit