#ssh #host #parallel #execute-command #toml #tool #spaces

app pssh-rs

pssh-rs is a parallel ssh tool written in rust

9 releases

0.2.7 Feb 21, 2023
0.2.6 Feb 16, 2023
0.2.4 Jan 9, 2023
0.2.2 Dec 8, 2022
0.1.0 Dec 3, 2022

#4 in #spaces

Download history 110/week @ 2024-02-24 8/week @ 2024-03-02 5/week @ 2024-03-09

123 downloads per month

Custom license

15KB
274 lines

pssh-rs is a parallel ssh tool written in rust.

Example

  1. run date command on 192.168.56.101 and 192.168.56.102:
./pssh-rs -h "192.168.56.101;192.168.56.102" -uroot -pmypassword -c 'date'

the hosts can be separated by comma, semicolon or spaces.

  1. using toml file to config hosts, suppose we have the following hosts.toml file:
$ cat ./hosts.toml 
username = "root"
password = "aaa"
port = 22
hosts = [
    "192.168.56.101",
    "192.168.56.102"
]

[nginx]
username = "ubuntu"
password = "bbb"
port = 22
hosts = [
    "192.168.57.101",
    "192.168.57.102"
]

[[nginx.host]]
host = "192.168.57.103"
password = "ccc"
port = 36000

[[nginx.host]]
host = "192.168.57.104"
username = "root"
password = "ddd"
port = 36000

execute date on all nginx hosts

./pssh-rs -t hosts.toml -s nginx -c 'date'

note that the username of 192.168.57.103 is ubuntu, which inherited from its parent nginx section.

Install

just run cargo install pssh-rs to install.

Building

pssh-rs can be built with cargo build --release, or using the following command to build statically:

sudo apt install musl-tools -y
rustup target add x86_64-unknown-linux-musl
cargo build --target=x86_64-unknown-linux-musl --release

Dependencies

~10–14MB
~279K SLoC