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. Use our Hosting referral link if you planning to start your blog ($3.82/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...

28 Responses

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

      @Marco

      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.

  2. Jose Luis Mantilla says:

    Anyone knows the difference between pssh and mpssh?

    • Ravi Saive says:

      @Jose,

      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.

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

  4. Rajasekar says:

    Stderr:
    —————————————————————–
    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

  5. Green says:

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

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

      @Deepak,

      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 *

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

Are you subscribed?