아래 스크립트의 문제점을 누구든지 도울 수 있습니까? 암호가 성공적으로 변경되었지만 암호는 이전 암호로 유지됩니다. 이 스크립트를 실행하여 ssh를 사용하여 전문가 모드로 직접 로그인하는 검사 점 SPLAT 방화벽 전문가 암호를 변경합니다.ssh를 사용하여 암호를 변경하는 스크립트가 필요합니다.
#!/usr/bin/expect
set username admin
set oldpass sam$$$
set newpass abc.123
spawn ssh -l $username 192.168.1.10
expect "assword:"
send "$oldpass\r"
expect "# "
sleep 1
send "passwd\r"
expect "Enter new expert password:"
send "$newpass\r"
expect "Enter new expert password (again):"
send "$newpass\r"
expect eof"
expect "# "
send "exit\n"
[[email protected] ~]$ ./test.sh
spawn ssh -l admin 192.168.1.10
[email protected]'s password:
Last login: Thu Oct 30 18:41:52 2014 from 192.168.1.5
[[email protected]]# passwd
Enter new expert password:
Enter new expert password (again):
Expert password has been changed
스크립트가 정상적으로 보입니다. '기대'때문에 문제가 보이지 않습니다. 너가 놓친 다른 것이 있을지도 모른다. – Dinesh