Pssh – Execute Commands on Multiple Remote Linux Servers Using Single Terminal

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. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  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.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

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...

36 Responses

  1. Ravi says:

    In CentOS 7 PSSH is available from the epel repo. All you have to do is yum install epel-release then yum install pssh. That’s it!

    Anyway thanks for the article.

  2. Mike says:

    this is awesome thanks for the tutorial makes updating vpn network so easy :)

  3. GA WILLBE says:

    I see there is a " -l " option to pass userid. How do I pass password of the host pro-grammatically. That is, the password must be sent from a script based on password entered in some web page.

  4. Jk says:

    I want to run multiple commands on servers instead of single command or is there any way that pssh read commands from a file one by one and print the output on terminal ?

    • Aaron Kili says:


      Yes, you specify the commands in a shell script, eg. and make it executable. Then use the -I flag to run commands from it, like this:

      #pssh -h hosts.txt -l ec2-user -P -I<./

      The flag:
      -h – specifies host file
      -l – specifies username
      -P – displays output as it arrives.
      -I – reads and sends commands from a script to ssh processes

      Try this out, thanks.

  5. Marco says:

    Good morning, is it possible to execute a command on different server using root user but every server has got a different root password and I don’t want install a key on every servers? If I use the following command:

    # pssh -h pssh-hosts -l root -A -i "uptime"

    the command ask to me the password, I enter the password of the first server, the command work for that server but failed on the others, I suppose pssh use the same password I insert for every server.

    Thank you in advance for any help. Regards

    • Aaron Kili says:


      That would be complicated, i suppose the easiest way to use Pssh is to install a key on every servers. I can not certainly tell if you can use it with different root passwords on the different servers.

  6. Jose Luis Mantilla says:

    Anyone knows the difference between pssh and mpssh?

    • Ravi Saive says:


      PSSH is for execute commands on multiple servers in parallel at the same time.

      MPSSH – Mass Parallel Secure Shell executes multiple parallel ssh binary instances on a list of hosts.

  7. Marcos Marinho says:

    I am try the following command

    # pssh -h /root/hosts.txt -l root -i -A -O StrictHostKeyChecking=no 'echo -e "NewPass\nNewPass" | passwd'

    And I am receiving this error message , any idea ?

    # [1] 10:11:31 [FAILURE]   Exited with error code 1

    And no password was changed.

  8. Rajasekar says:

    This network/computer system is for the use of authorized
    users only. Users (authorized or unauthorized) should have
    no explicit or implicit expectations of privacy. Individuals
    using this network/computer system without authority, or in
    excess of their authority, are subject to having all of their
    activities on this network/computer system monitored, recorded,
    and disclosed by system personnel. In the course of monitoring
    individuals improperly using this network/computer system, or
    in the course of system operation or maintenance or for the
    purpose of protecting the rights or property of the system
    provider, the activities of authorized users maybe monitored,
    recorded, and disclosed. Anyone using this network/computer
    system expressly consents to such monitoring, recording, and
    disclosure and is advised that if such monitoring reveals
    possible evidence of criminal activity, system personnel may
    provide the resulting evidence to law enforcement officials
    how to exclude the stderr for this

  9. Green says:

    If you use windows desktop, download nic from, good tool for run remote commands on multiple UNIX/Linux hosts.

  10. Deepak says:

    Am trying to copy file from my local machine to remote servers , i need it to copy using pscp i have tried above command in my linux terminal. can you suggest me

    • Ravi Saive says:


      Have you created PSSH host file with IP address of remote host? If yes, try to run the following command to copy file from local to remote location.

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

      If you still unable to do so, please post the output of the command here, so that we can help you out..

Got something to say? Join the discussion.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.