Linux multiple remote device transfer files

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.