vi mkqpasswd (for qmail account under RH Linux)
#!/usr/bin/expect -f
set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
sleep 2
expect "password:"
sleep 10
send "$password\r"
sleep 10
expect "password:"
sleep 10
send "$password\r"
sleep 10
expect eof
#useradd toto
#./mkqpasswd toto p0o9I8U7y6
clear the .bash_history if you are security paranoid...
the sleep is necessary, i connect to office linux server with 33.6 modem, i put 5, didn't work, so i put 10, it works fine now. if i work locally, possible i need only 5, i will check this later.
i also tried with the mkpasswd come with expect(1), it didn't work either.
ps1: you can find expect rpm in cd 2 of RH Linux, it is not installed by default, strange thought.
ps2: beware of your version of *unix, some version has strong passwd scheme configured, try give a REAL passwd.
#!/usr/bin/expect -f
set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
sleep 2
expect "password:"
sleep 10
send "$password\r"
sleep 10
expect "password:"
sleep 10
send "$password\r"
sleep 10
expect eof
#useradd toto
#./mkqpasswd toto p0o9I8U7y6
clear the .bash_history if you are security paranoid...
the sleep is necessary, i connect to office linux server with 33.6 modem, i put 5, didn't work, so i put 10, it works fine now. if i work locally, possible i need only 5, i will check this later.
i also tried with the mkpasswd come with expect(1), it didn't work either.
ps1: you can find expect rpm in cd 2 of RH Linux, it is not installed by default, strange thought.
ps2: beware of your version of *unix, some version has strong passwd scheme configured, try give a REAL passwd.