Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Scp automatically writes password scripts

Shulou Source: shulou.com Published: 2022-06-03 05:13:52 11月24日 Update

Scp automatically writes password scripts

#! / usr/bin/expectset timeout 10set host [lindex $argv 0] set username [lindex $argv 1] set password [lindex $argv 2] set src_file [lindex $argv 3] set dest_file [lindex $argv 4] spawn scp $src_file $username@$host:$dest_file expect {"(yes/no)?" {send "yes\ n" expect "* assword:" {send "$password\ n"} "* assword:" {send "$password\ n"} expect "100" expect eof

Use format:

. / scp.sh [destination IP address] [user name] [password] [File name] [destination location]

. / scp.sh 172.168.24.1 root awcloud demo.tar.gz / root/

Tags: Password target script location address file name format user user name Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker vpn Shulou Tech Info NVidia Huawei