thanks to ian.mcgingley at axa-tech.com.au from actually sending a script, and giving me some ideas. NOTE: puting all the password in a spreadsheet is a great securuty risk, and has been noticed. the solution is divided in two parts 1.- the spreadsheet must be saved in a csv file (coma separated values, without double quotes " ) 2.- two scripts, 1 in shell to get the useradd bin working and another using expect to get the password. here are the two scripts. put_passwd.expect #!/opt/sfw/bin/expect if $argc<2 { send_user "$argv0: missing parameters\n" exit } set username [lindex $argv 0 ] set password [lindex $argv 1 ] spawn passwd $username expect "ew Password:" send "$password\r" expect "ew Password:" send "$password\r" expect "#" exit the putuser.sh which call the first one. #!/bin/bash FILEIN=$1 SGID=100 USERSHOME=/export/home/users USERSSHELL=/bin/false USRCRTLOG=/var/log/usercreation.log IFS=, cat $FILEIN | while read internalvalue comentario password userid anotherdata do useradd -g $GID -c "$comentario $internalvalue " -d $USERSHOME/$userid -s $USERSSHELL -m -k /etc/skel $userid 2> $USRCRTLOG ./put_passwd.expect $userid $password 2>> /var/log/useradd.log done -- Ing. Cngel Alejandro Vega Soto (52)55-23-19-75 TecnologC-a InformC!tica y ConsultorC-a (52)53-36-95-28 alejandro.vega_at_tecinfocon.com.mx http://www.tecinfocon.com.mx Gerente de Servicio, Solaris - Linux, Software and protocols specialist _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Thu Sep 29 12:22:22 2005
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:52 EST