SUMMARY: tool generate mujltiple (thousands ) of accounts in /etc/passwd and /etc/shadow, solaris 9
From: Angel Alejandro Vega Soto (alejandro.vega_at_tecinfocon.com.mx)
Date: 09/29/05
- Previous message: Bob: "lxrun Problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: Sunmanagers <sunmanagers@sunmanagers.org> Date: Thu, 29 Sep 2005 11:20:47 -0500
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 spread*** is a great securuty risk,
and has been noticed.
the solution is divided in two parts
1.- the spread*** 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@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/sunmanagers
- Previous message: Bob: "lxrun Problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]