Hi, I'm trying to create a script to update a password in a non-interactive way. It's working on my laptop but fails on my server. Both are running the same configuration, using Etch.
This is the script: -------------------- #!/usr/bin/expect -f # Change user passwd set timeout 30 strace 4 set password [lindex $argv 1] set old_password [lindex $argv 2] spawn passwd [lindex $argv 0] sleep 1 expect "(current) UNIX password: $" send "$old_password\r" expect "Enter new UNIX password: $" send "$password\r" expect "Retype new UNIX password: $" send "$password\r" expect eof -------------------- On the server the output looks like this: myu...@server:~$ /home/myuser/adm/chpasswd myuser NewPasswd OldPasswd 2 lindex $argv 0 1 set username [lindex $argv 0] 2 lindex $argv 1 1 set password [lindex $argv 1] 2 lindex $argv 2 1 set old_password [lindex $argv 2] 1 spawn passwd $username spawn passwd myuser 1 sleep 1 1 expect "(current) UNIX password: $" Changing password for myuser (current) UNIX password: 1 send "$old_password\r" 1 expect "Enter new UNIX password: $" OldPasswd Enter new UNIX password: 1 send "$password\r" 1 expect "Retype new UNIX password: $" NewPasswd 1 send "$password\r" 1 expect eof Retype new UNIX password: 1 exit 0 ---------------------------------------------------- but strangely enough, on my laptop: t...@mars:/home/test/adm$ ./chpasswd test NewPasswd OldPasswd 2 lindex $argv 1 1 set password [lindex $argv 1] 2 lindex $argv 2 1 set old_password [lindex $argv 2] 2 lindex $argv 0 1 spawn passwd [lindex $argv 0] spawn passwd test 1 sleep 1 1 expect "(current) UNIX password: $" Changing password for test (current) UNIX password: 1 send "$old_password\r" 1 expect "Enter new UNIX password: $" OldPasswd Enter new UNIX password: 1 send "$password\r" 1 expect "Retype new UNIX password: $" NewPasswd Retype new UNIX password: 1 send "$password\r" 1 expect eof NewPasswd passwd: password updated successfully 1 exit 0 ------------------------------------------------------------- Could this be a difference in the configuration of the authentification ? Thanks -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org