PDA

View Full Version : How to automatically set password for user knoppix.



usepix
10-19-2006, 08:19 PM
Hello, I have a bash script named newpw I got from another forum:
it executes as newpw knoppix 123456 where 123456 is the new password
#!/bin/bash
# \
exec expect -f "$0" ${1+"$@"}
set password [lindex $argv 1]
spawn passwd [lindex $argv 0]
expect "assword:"
send "$password\r"
expect "assword:"
send "$password\r"
expect eof
It seems to execute OK when I chmod to 777 newpw. However the new password is not taking. When I try to ftp into the machine the only password that works is one I set up by executing passwd knoppix at the command line directly. Any ideas on how to get this to work? Thanks