Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

ssh to two servers

I have setup keys between three Centos 5.2 servers.  One server will copy to lweb1 and lweb2.

The following individual commands work.
[username@lqa ~]$ scp test.txt username@lweb1:/home/username/
[username@lqa ~]$ scp test.txt username@lweb2:/home/username/

scp help looks like it can copy to two servers at the same time (user@host1, user@host2)
[username@lqa ~]$ scp
usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-o ssh_option] [-P port] [-S program]
           [[user@]host1:]file1 [...] [[user@]host2:]file2

This is what happens when I try to copy to two servers at the same time.  

[username@lqa ~]$ scp test.txt username@lweb1:/home/username/ username@lweb2:/home/username/              
          deploynotes.txt                                                                     100%   35     0.0KB/s   00:00
username@lweb2's password:
/home/username: not a regular file
Killed by signal 1.
Connection to lweb1 closed.

Can I not copy to two servers at the same time in scp?
0
magnusthorne
Asked:
magnusthorne
1 Solution
 
giltjrCommented:
No SCP can't copy to two hosts at once the host1 and host2 options allow you to copy a file from remote host1 to remote host2.

From: http://www.hypexr.org/linux_scp_help.php

Example to copy the file "foobar.txt" from remote host "rh1.edu" to remote host "rh2.edu"

scp your_username@rh1.edu:/some/remote/directory/foobar.txt your_username@rh2.edu:/some/remote/directory/
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now