3 # smbadduser - Written by Mike Zakharoff
6 set path = ($path /usr/local/samba/bin)
8 set smbpasswd = /usr/local/samba/private/smbpasswd
9 set user_map = /usr/local/samba/lib/users.map
11 # Set to site specific passwd command
13 #set passwd = "cat /etc/passwd"
14 #set passwd = "niscat passwd.org_dir"
15 set passwd = "ypcat passwd"
17 set line = "----------------------------------------------------------"
20 echo "Written: Mike Zakharoff email: michael.j.zakharoff@boeing.com"
22 echo " 1) Updates $smbpasswd"
23 echo " 2) Updates $user_map"
24 echo " 3) Executes smbpasswd for each new user"
26 echo "smbadduser unixid:ntid unixid:ntid ..."
28 echo "Example: smbadduser zak:zakharoffm johns:smithj"
33 touch $smbpasswd $user_map
36 echo $one | grep ':' >& /dev/null
37 if ($status != 0) then
38 echo "ERROR: Must use unixid:ntid like -> zak:zakharoffm"
41 set unix = `echo $one | awk -F: '{print $1}'`
42 set ntid = `echo $one | awk -F: '{print $2}'`
44 set usr = `eval $passwd | awk -F: '$1==USR {print $1}' USR=$unix`
46 echo "ERROR: $unix Not in passwd database SKIPPING..."
49 set tmp = `cat $smbpasswd | awk -F: '$1==USR {print $1}' USR=$unix`
51 echo "ERROR: $unix is already in $smbpasswd SKIPPING..."
55 echo "Adding: $unix to $smbpasswd"
58 printf( "%s:%s:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:%s:%s:%s\n", $1, $3, $5, $6, $7) }' USR=$unix >> $smbpasswd
59 if ($unix != $ntid) then
60 echo "Adding: {$unix = $ntid} to $user_map"
61 echo "$unix = $ntid" >> $user_map
63 set new = ($new $unix)
67 # Enter password for new users
71 echo "ENTER password for $one"