Forrest logo
back to the pssh tool

pssh:tldr:92b74

pssh: Run a command as root (this asks for the root password).
$ pssh -i -h ${path-to-hosts_file} -A -l ${root_username} ${hostname -i}
try on your machine

This command is using the pssh tool to execute commands on multiple remote hosts in parallel.

Here is the breakdown of the command and its components:

  • pssh: It is the command-line tool used for running commands in parallel on multiple hosts.
  • -i: This flag tells pssh to display its progress in real-time.
  • -h ${path-to-hosts_file}: This option specifies the path to the file containing a list of hostnames or IP addresses of the remote hosts. Each host should be on a separate line.
  • -A: This flag enables agent forwarding, allowing the user to authenticate with the remote hosts using their local SSH agent.
  • -l ${root_username}: This option specifies the username to be used when connecting to the remote hosts. ${root_username} should be replaced with the actual username.
  • ${hostname -i}: This is a command substitution that will be replaced with the output of hostname -i. The hostname -i command is used to retrieve the IP address of the local host. This IP address will be used as the source address when connecting to the remote hosts.

So, when you run this command, pssh will connect to each host listed in the ${path-to-hosts_file} file using the ${root_username} as the remote username. It will execute commands on each host in parallel and display the progress in real-time. The source IP address for the connections will be the IP address of the local host.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the pssh tool