1pssh(1) General Commands Manual pssh(1)
2
3
4
6 pssh — parallel ssh program
7
8
9
11 pssh [-vAiIP] [-h hosts_file] [-H [user@]host[:port]] [-l user] [-p
12 par] [-o outdir] [-e errdir] [-t timeout] [-O options] [-x args] [-X
13 arg] command ...
14
15 pssh -I [-vAiIP] [-h hosts_file] [-H [user@]host[:port]] [-l user] [-p
16 par] [-o outdir] [-e errdir] [-t timeout] [-O options] [-x args] [-X
17 arg] [command ...]
18
19
20
22 pssh is a program for executing ssh in parallel on a number of hosts.
23 It provides features such as sending input to all of the processes,
24 passing a password to ssh, saving output to files, and timing out.
25
26
27
29 -h host_file
30 --hosts host_file
31 Read hosts from the given host_file. Lines in the host file are
32 of the form [user@]host[:port] and can include blank lines and
33 comments (lines beginning with "#"). If multiple host files are
34 given (the -h option is used more than once), then pssh behaves
35 as though these files were concatenated together. If a host is
36 specified specified multiple times, then pssh will connect the
37 given number of times.
38
39 -H [user@]host[:port]
40 --host [user@]host[:port]
41 -H "[user@]host[:port] [ [user@]host[:port ] ... ]"
42 --host "[user@]host[:port] [ [user@]host[:port ] ... ]"
43 Add the given host strings to the list of hosts. This option
44 may be given multiple times, and may be used in conjunction with
45 the -h option.
46
47 -l user
48 --user user
49 Use the given username as the default for any host entries that
50 don't specifically specify a user.
51
52 -p parallelism
53 --par parallelism
54 Use the given number as the maximum number of concurrent connec‐
55 tions.
56
57 -t timeout
58 --timeout timeout
59 Make connections time out after the given number of seconds.
60 With a value of 0, pssh will not timeout any connections.
61
62 -o outdir
63 --outdir outdir
64 Save standard output to files in the given directory. Filenames
65 are of the form [user@]host[:port][.num] where the user and port
66 are only included for hosts that explicitly specify them. The
67 number is a counter that is incremented each time for hosts that
68 are specified more than once.
69
70 -e errdir
71 --errdir errdir
72 Save standard error to files in the given directory. Filenames
73 are of the same form as with the -o option.
74
75 -x args
76 --extra-args args
77 Passes a extra SSH command-line arguments (see the ssh(1) man
78 page for more information about SSH arguments). This option may
79 be specified multiple times. The arguments are processed to
80 split on whitespace, protect text within quotes, and escape with
81 backslashes. To pass arguments without such processing, use the
82 -X option instead.
83
84 -X arg
85 --extra-arg arg
86 Passes a single SSH command-line argument (see the ssh(1) man
87 page for more information about SSH arguments). Unlike the -x
88 option, no processing is performed on the argument, including
89 word splitting. To pass multiple command-line arguments, use
90 the option once for each argument.
91
92 -O options
93 --options options
94 SSH options in the format used in the SSH configuration file
95 (see the ssh_config(5) man page for more information). This
96 option may be specified multiple times.
97
98 -A
99 --askpass
100 Prompt for a password and pass it to ssh. The password may be
101 used for either to unlock a key or for password authentication.
102 The password is transferred in a fairly secure manner (e.g., it
103 will not show up in argument lists). However, be aware that a
104 root user on your system could potentially intercept the pass‐
105 word.
106
107 -i
108 --inline
109 Display standard output and standard error as each host com‐
110 pletes.
111
112 -v
113 --verbose
114 Include error messages from ssh with the -i and \ options.
115
116 -I
117 --send-input
118 Read input and send to each ssh process. Since ssh allows a
119 command script to be sent on standard input, the -I option may
120 be used in lieu of the command argument.
121
122 -P
123 --print
124 Display output as it arrives. This option is of limited useful‐
125 ness because output from different hosts are interleaved.
126
127
129 Connect to host1 and host2, and print "hello, world" from each:
130 pssh -i -H "host1 host2" echo "hello, world"
131
132 Print "hello, world" from each host specified in the file hosts.txt:
133 pssh -i -h hosts.txt echo "hello, world"
134
135 Run a command as root with a prompt for the root password:
136 pssh -i -h hosts.txt -A -l root echo hi
137
138 Run a long command without timing out:
139 pssh -i -h hosts.txt -t 0 sleep 10000
140
141 If the file hosts.txt has a large number of entries, say 100, then the
142 parallelism option may also be set to 100 to ensure that the commands
143 are run concurrently:
144 pssh -i -h hosts.txt -p 100 -t 0 sleep 10000
145
146 Run a command without checking or saving host keys:
147 pssh -i -H host1 -H host2 -x "-O StrictHostKeyChecking=no -O
148 UserKnownHostsFile=/dev/null -O GlobalKnownHostsFile=/dev/null"
149 echo hi
150
151
153 0 Success
154
155 1 Miscellaneous error
156
157 2 Syntax or usage error
158
159 3 At least one process was killed by a signal or timed out.
160
161 4 All processes completed, but at least one ssh process reported
162 an error (exit status 255).
163
164 5 There were no ssh errors, but at least one remote command had a
165 non-zero exit status.
166
167
169 Written by Brent N. Chun <bnc@theether.org> and Andrew McNabb <amcn‐
170 abb@mcnabbs.org>.
171
172 http://code.google.com/p/parallel-ssh/
173
174
176 ssh(1), pscp(1), prsync(1), pslurp(1), pnuke(1)
177
178
179
180 February 25, 2010 pssh(1)