3 # smbadduser - Written by Mike Zakharoff
6 set path
= ($path /usr
/local
/samba
/bin
)
8 set smbpasswd
= /usr
/local
/samba
/private
/smbpasswd
9 #set smbpasswd = /etc/samba/smbpasswd
10 set user_map
= /usr
/local
/samba
/lib
/users.map
11 #set user_map = /etc/samba/smbusers
13 # Set to site specific passwd command
15 set passwd
= "cat /etc/passwd"
16 #set passwd = "niscat passwd.org_dir"
17 #set passwd = "ypcat passwd"
19 set line
= "----------------------------------------------------------"
22 echo "Written: Mike Zakharoff email: michael.j.zakharoff@boeing.com"
24 echo " 1) Updates $smbpasswd"
25 echo " 2) Updates $user_map"
26 echo " 3) Executes smbpasswd for each new user"
28 echo "smbadduser unixid:ntid unixid:ntid ..."
30 echo "Example: smbadduser zak:zakharoffm johns:smithj"
35 touch $smbpasswd $user_map
38 echo $one |
grep ':' >& /dev
/null
39 if ($status != 0) then
40 echo "ERROR: Must use unixid:ntid like -> zak:zakharoffm"
43 set unix
= `echo $one | awk -F: '{print $1}'`
44 set ntid
= `echo $one | awk -F: '{print $2}'`
46 set usr
= `eval $passwd | awk -F: '$1==USR {print $1}' USR=$unix`
48 echo "ERROR: $unix Not in passwd database SKIPPING..."
51 set tmp
= `cat $smbpasswd | awk -F: '$1==USR {print $1}' USR=$unix`
53 echo "ERROR: $unix is already in $smbpasswd SKIPPING..."
57 echo "Adding: $unix to $smbpasswd"
58 /usr
/bin
/smbpasswd
-a -n $unix
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"