2024-07-07 16:10:34 -07:00

17 lines
357 B
Plaintext

#!/usr/bin/expect -f
set user [lindex $argv 0]
set pass [lindex $argv 1]
set ip_addr [lindex $argv 2]
set new_pass [lindex $argv 3]
spawn ssh -o "StrictHostKeyChecking no" $user@$ip_addr passwd
expect "assword:"
send "$pass\r"
expect "Current password:"
send "$pass\r"
expect "password:"
send "$new_pass\r"
expect "password:"
send "$new_pass\r"
expect eof