#!/usr/local/rexx/rxx /* * make_user - makes a userid for AIX/3. The new userid has no password, * but the first time someone logs on to the account, he is * required to select a password. Must be "root" to run * make_user. * * * Modification History: * * 16 May 94 twg Initial implementation * */ parse arg user if user='' then do say 'usage: make_user new_userid' exit 4 end call backup /* define files to be processed and make backups of 'em */ 'mkuser' user /* make a new account for this user */ call null user /* make null password so next step will work */ 'pwdadm -f ADMCHG' user /* mark for password change req on next login */ call null2 user /* null password in lookaside file so user can login */ exit 0 /** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ backup: /* this routine sets filenames and makes backup copies */ old='/etc/passwd' /* traditional unix password file */ new='/etc/passwd.new' back='/etc/passwd.old' 'cp' old back old2='/etc/security/passwd' /* special AIX password lookaside file */ new2='/etc/security/passwd.new' back2='/etc/security/passwd.old' 'cp' old2 back2 return /** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ null: /* this routine directly modifies */ do while lines(old) > 0 /* /etc/passwd to remove the */ line=linein(old) /* password from an account */ if abbrev(line, user) then do parse var line u ':' . ':' rest line=u'::'rest end call lineout new, line end call lineout new /* close the files */ call lineout old 'mv' new old return /** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ null2: /* this routine directly modifies */ do while lines(old2) > 0 /* /etc/security/passwd to remove */ line=linein(old2) /* the password from an account */ if abbrev(line, user) then found='y' else if found='y' then do parse var line a b c . if a = 'password' then do line = ' 'a b ' ' found='n' end end call lineout new2, line end call lineout new2 /* close the files */ call lineout old2 'mv' new2 old2 return