
June 29th, 2005, 05:36 PM
|
|
Contributing User
|
|
Join Date: Feb 2004
Posts: 104
Time spent in forums: 1 Day 5 h 41 m 29 sec
Reputation Power: 5
|
|
|
Shell Script with "expect"
Hello all;
Using Debian Sarge, I'm developing a small server with Samba, Postfix and Apache installed. I want to add users in a shell script for now. I've been told to use "Expect" so that I only need to take the user's password once and feed it to all the other programs. I have searched the web and keep finding this script:
Code:
#!/usr/local/bin/expect --
# wrapper to make passwd(1) be non-interactive
# username is passed as 1st arg, passwd as 2nd
# Executable only by root
set password [lindex $argv 1]
spawn /usr/bin/passwd [lindex $argv 0]
expect "password:"
send "$password\r"
expect "password:"
send "$password\r"
expect eof
# end script
Only problem is that it doesn't seem to work for me. I'm using expect version 5.42.1 installed via apt-get.
Anyone have a similar script that works???
Thx
Ben Z
|