3 # smbadduser - Written by Mike Zakharoff
7 exec_prefix
=@exec_prefix@
9 PRIVATEDIR
=@privatedir@
13 set path
= ($path /usr
/bin
)
15 set smbpasswd
= $PRIVATEDIR/smbpasswd
16 set user_map
= $CONFIGDIR/smbusers
19 # Set to site specific passwd command
21 set passwd
= "getent passwd"
22 #set passwd = "niscat passwd.org_dir"
23 #set passwd = "ypcat passwd"
25 set line
= "----------------------------------------------------------"
28 echo "Written: Mike Zakharoff email: michael.j.zakharoff@boeing.com"
30 echo " 1) Updates $smbpasswd"
31 echo " 2) Updates $user_map"
32 echo " 3) Executes smbpasswd for each new user"
34 echo "smbadduser unixid:ntid unixid:ntid ..."
36 echo "Example: smbadduser zak:zakharoffm johns:smithj"
41 touch $smbpasswd $user_map
44 echo $one |
grep ':' >& /dev
/null
45 if ($status != 0) then
46 echo "ERROR: Must use unixid:ntid like -> zak:zakharoffm"
49 set unix
= `echo $one | awk -F: '{print $1}'`
50 set ntid
= `echo $one | awk -F: '{print $2}'`
52 set usr
= `eval $passwd | awk -F: '$1==USR {print $1}' USR=$unix`
54 echo "ERROR: $unix Not in passwd database SKIPPING..."
57 set tmp
= `cat $smbpasswd | awk -F: '$1==USR {print $1}' USR=$unix`
59 echo "ERROR: $unix is already in $smbpasswd SKIPPING..."
63 echo "Adding: $unix to $smbpasswd"
64 /usr
/bin
/smbpasswd
-a -n $unix
65 if ($unix != $ntid) then
66 echo "Adding: {$unix = $ntid} to $user_map"
67 echo "$unix = $ntid" >> $user_map
69 set new
= ($new $unix)
73 # Enter password for new users
77 echo "ENTER password for $one"