Pscp – Transfer/Copy Files to Multiple Linux Servers Using Single Shell

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

9 Responses

  1. Ankit Tiwari says:

    Hi,
    I am following this tutorial to copy a file to multiple system but its giving error. The code i am using is
    pscp -h myhost.txt -l zabbix -Av show-image-1920×1080.jpg /home/zabbix/
    but it gives error
    [1] 11:18:50 [FAILURE] 192.168.0.244:22 Exited with error code 1

    • Ravi Saive says:

      @Ankit,

      Have you placed correct remote SSH host IP address and port number in the myscphosts.txt file? please confirm and add correct values and then try again..

  2. jHz says:

    Hi,

    I am trying to copy one file from 30 hosts to one central computer by following you article but no success.
    I am using pscp command for this purpose:

    pscp -h hosts.txt /camera/1.jpg /camera/1.jpg

    where camera directory has been created already in which 1.jpg exists. It always give me error:

    Exited with error code 1

    I have also tried pscp command to copy file from one host to server:

    pscp -H “192.168.0.101” /camera/1.jpg /camera/1.jpg

    but it also returned me with the same error.

    Any help will be much appreciated.
    Thanks in advance.

    • Ravi Saive says:

      @jHz,

      Have you created “myscphosts.txt” file on local machine with list of remote Linux server IP addresses and their respective SSH ports? and the correct command to copy the file from local to remote is:

      # pscp -h myscphosts.txt -l tecmint -Av wine-1.7.55.tar.bz2 /tmp/
      OR
      # pscp.pssh -h myscphosts.txt -l tecmint -Av wine-1.7.55.tar.bz2 /tmp/
      

      explanation about the options used in the above command.

      -h switch used to read a hosts from a given file and location.
      -l switch reads a default username on all hosts that do not define a specific user.
      -A switch tells pscp ask for a password and send to ssh.
      -v switch is used to run pscp in verbose mode.

      • jHz says:

        Yes I have created hosts ip file in which I saved all ips with port numbers. I am using the same command and syntax but it returns me with error: Exited with error code 1.

        • Ravi Saive says:

          @jHz,

          You were using wrong -H switch and also you didn’t mentioned about -l option used to specify username to connect to the server, I suggest you to run the commands which I given in the comments…and see.

  3. anil says:

    Above article is not working in ubuntu 12.04

    • Ravi Saive says:

      @Anil,

      Sorry for trouble, could you please tell us why it’s not working? did you get any error while installing? Please share with us your problem, so that we can help you out..

  4. Jalal Hajigholamali says:

    Hi,
    Thanks a lot
    Very nice and useful article
    Thanks again

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 202,035
  2. 9,267
  3. 38,621

Are you subscribed?