I put this file in /pkgs/ldapprogs/bin/autohome.sh
Then ln -s /pkgs/ldapprogs/bin/autohome.sh /etc/auto_home
Don't forget to chmod 750 /pkgs/ldapprogs/bin/autohome.sh

#!/bin/sh
#!# autohome.sh - v1.1 by Jason Oakley ([EMAIL PROTECTED]) 10/04/02
#!# This script is used by automountd to mount home directories.
#!# It gets the data from LDAP on your LDAP server
#!# It will output the mount point eg server4:/export/home/joakley

#!# The name of our LDAP server
LDAPSERVER="ldap.server.name.com"

#!# The Context of our LDAP data
CONTEXT="ou=Department,o=Company"

#!# The username to search on (from the Commandline Argument list)
USERNAME=$1

#!# The LDAP entry field holding the mount point
SEARCH="nisMapEntry"

#!# Grab the users' data from LDAP and strip out just the Mount Point data
SEARCHDATA=`/usr/bin/ldapsearch -h $LDAPSERVER -b $CONTEXT cn=$USERNAME | 
/usr/bin/grep $SEARCH`

#!# Take out the users mountpoint discarding the "nisMapEntry=" part of the line
MOUNTPOINT=`/usr/bin/echo $SEARCHDATA | /usr/bin/awk -F"=" '{print $2}'`

#!# Convert server4:/export/home/& to server4:/export/home/username
USERMOUNTPOINT=`/usr/bin/echo $MOUNTPOINT | /usr/bin/sed "s/&/$1/"`

#!# Output the data to STDOUT
/usr/bin/echo $USERMOUNTPOINT


--------------------------
Jason Oakley +612 8282 1434
MSG Security Administrator
AAPT -- Glebe -- Australia
  http://www.aapt.com.au

Windows XP - The most popular $400 solitaire game


Reply via email to