Files
svc.ems/src/accountMgr/c_program/sftpSend/initKeys
agtuser 530f9116ae init
2024-11-11 17:55:10 +08:00

33 lines
543 B
Plaintext
Executable File

#!/usr/bin/expect
#This script use to init the server keys, it rewrite the known_hosts config file
#This script have 3 parameters
#remoteip: the ip of the remote server
#username: the name for logging in
#userpass: the password for logging in
set remoteip [lindex $argv 0]
set username [lindex $argv 1]
set userpass [lindex $argv 2]
set timeout 5
spawn sftp $username@$remoteip
expect "*(yes/no)?*"
send "yes\n"
expect "*password*"
send "$userpass\n"
expect "*sftp>*"
send "quit\n"
expect eof
exit