Skip to content

pssh

homepage-banner

What is PSSH?

PSSH stands for Parallel SSH, and it is a command-line tool that allows you to run SSH commands on multiple servers simultaneously. PSSH is an open-source tool that is available for Linux, macOS, and Windows. With PSSH, you can run commands on a large number of servers, and the tool will distribute the commands across all machines.

How does PSSH work?

PSSH uses SSH to connect to the remote servers and execute commands. When you run a command with PSSH, it creates a separate SSH connection to each server. Once the connections are established, PSSH sends the command to each server, and the tool collects the output from each machine and presents it to you in a single console window.

Advantages of using PSSH

Using PSSH has several advantages over manually connecting to each server and running commands individually. Firstly, it saves time. With PSSH, you can run commands on multiple servers simultaneously, which can significantly reduce the time it takes to perform a task. Secondly, it is easy to use. PSSH has a simple syntax that makes it easy to learn and use, even for those who are not familiar with command-line tools. Lastly, PSSH is scalable. You can use PSSH to manage a small or large number of servers, and the tool will distribute the commands across all machines.

Usage

execute local script on remote machines with pssh

Special characters in the target command may cause problems when executing in batches with pssh. In this case, you can consider using a script and redirection to execute remotely.

pssh -h RemoteHosts.ip -P -I < ~/LocalScript.sh

Skip strict host key check in pssh

When using pssh to manage machines in batches, in order to avoid entering yes to confirm host key checking, you can add the following ssh parameter:

pssh -O "StrictHostKeyChecking=no" -O "UserKnownHostsFile=/dev/null"

Batch send/retrive file with pscp/pslurp

send files/dir

pscp -h ip.file local_file remote_dir
## eg.
pscp -h hosts.ip file.txt ~/

receive files/dir

pslurp -h ip_file -L local_dir  remote_file local_file
Leave a message