User Tools

Site Tools


archive:centos_install_pssh

CentOS install Pssh

Pssh allows you to run ssh commands and more on multiple hosts.

Install pssh

yum install pssh

Right let's create a symlink to pscp, pscp will work but if we don't create the link the command is pscp.pssh instead of pscp.

Note this has nothing to do with pssh this is only needed if you plan on using pscp.

ln -s /usr/bin/pscp.pssh /usr/bin/pscp

Config files

Create a hostfile to use with pssh

touch /home/user/.ssh/hosts

In the above hostfile add hosts as username@ip or username@hostname example:

ansible@hostname
[email protected]

pssh private key

If you need a private key in order to connect you need a config file in your

touch /home/user/.ssh/config

The config file can have multiple hosts with multiple keys example:

Host *.mgt
StrictHostKeyChecking no
IdentityFile ~/.ssh/some_private_key

Host wonka.mgt
StrictHostKeyChecking no
IdentityFile ~/.ssh/another_private_key

Host xxx.xxx.xxx.xxx
StrictHostKeyChecking no
IdentityFile ~/.ssh/another_private_key

Pssh test

pssh -i -h hosts uptime

if the user has sudo rights you can try this as well

pssh -i -h hosts sudo cp /root/some_file_with_root_permissions /home/some_other_user

Pscp test

The above example works with pscp as well. If you did not create a link as descriped in the beginning use pscp.pssh instead of pscp.

pscp -h hosts sample.txt /home/user_home_dir/

Prsync test

prsync -h hosts sample.txt /home/user_home_dir/
archive/centos_install_pssh.txt · Last modified: 24/11/2023 12:44 by Allan