Transfer files into two Linux local-----> Remote Linuxlinux Local <-----Remote Linux There are two main ways: FTP and scp1.ftp: Way login ftp:>ftp [email protected] # You will need to enter the password later or: >ftp remote #回车后提示输入用户名和密码上传 | Smash file: Put/home/user/t.sh/home/remotedir get/home/user/remotefile/home/ LocalFile here, let's talk about FTP. Multiple devices are passed with the specified password: mv.sh#!/bin/kshroot=rootpwd=pwdremoteips= ' 10.71.148.15 10.71.148.23 ' for IP in Remoteipsdoftp $ip < Remote linux directive: SCP local_file [email protected]_ip:remote_folder linux Local <-----remote linux directive: SCP [Email PROTECTED]_IP: Remote_folder Local_file Detailed connection: http://www.cnblogs.com/hitwtx/archive/2011/11/16/2251254.html here to talk about how to implement multiple devices transmission Implementation steps: 1) write a expect plugin for the Xshell script to implement a device's transmission programming input password exp.sh #!/usr/bin/expect-f set timeout ten set username [lindex $argv 0] s ET password [lindex $argv 1] set hostname [lindex $argv 2] Spawn SCP [email protected] $hostname expect "yes/no" send " Yes\r "expect" Password: "send" $password \ r "expect EOF test:./exp.sh root Pasword hostname1 #expect接收参数的方式和bash脚本的方式不太一 Like, Bash is through the $ ... $n this way, and expect is through set <变量名称> <变量名称> [lindex $argv ], such as set username [lindex $argv 0] 2) write a circular call script #!/bin/ksh #定义一个远程主机ip数组, or through the file Query method Remotei ps= ' 10.71.148.15 10.71.148.23 ' uesrname=root passwd= pwd for IP in $remoteips does./exp.sh $uesrname $pwd $ip done before making sure the file is Execute >chmod +x xx.sh
Linux multiple remote device transfer files