1pssh(1)                     General Commands Manual                    pssh(1)
2
3
4

NAME

6       pssh — parallel ssh program
7
8
9

SYNOPSIS

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

DESCRIPTION

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       The  PSSH_NODENUM  and  PSSH_HOST environment variables are sent to the
27       remote host.  The PSSH_NODENUM variable is assigned a unique number for
28       each  ssh  connection,  starting with 0 and counting up.  The PSSH_HOST
29       variable is assigned the name of the host as  specified  in  the  hosts
30       list.   Note  that  sshd  drops  environment  variables  by default, so
31       sshd_config on the remote host must include the line:
32              AcceptEnv PSSH_NODENUM PSSH_HOST
33
34

OPTIONS

36       -h host_file
37       --hosts host_file
38              Read hosts from the given host_file.  Lines in the host file are
39              of  the  form [user@]host[:port] and can include blank lines and
40              comments (lines beginning with "#").  If multiple host files are
41              given  (the -h option is used more than once), then pssh behaves
42              as though these files were concatenated together.  If a host  is
43              specified  multiple times, then pssh will connect the given num‐
44              ber of times.
45
46       -H     [user@]host[:port]
47       --host [user@]host[:port]
48       -H     "[user@]host[:port] [ [user@]host[:port ] ... ]"
49       --host "[user@]host[:port] [ [user@]host[:port ] ... ]"
50              Add the given host strings to the list of  hosts.   This  option
51              may be given multiple times, and may be used in conjunction with
52              the -h option.
53
54       -l user
55       --user user
56              Use the given username as the default for any host entries  that
57              don't specifically specify a user.
58
59       -p parallelism
60       --par parallelism
61              Use the given number as the maximum number of concurrent connec‐
62              tions.
63
64       -t timeout
65       --timeout timeout
66              Make connections time out after the  given  number  of  seconds.
67              With a value of 0, pssh will not timeout any connections.
68
69       -o outdir
70       --outdir outdir
71              Save standard output to files in the given directory.  Filenames
72              are of the form [user@]host[:port][.num] where the user and port
73              are  only  included for hosts that explicitly specify them.  The
74              number is a counter that is incremented each time for hosts that
75              are specified more than once.
76
77       -e errdir
78       --errdir errdir
79              Save  standard error to files in the given directory.  Filenames
80              are of the same form as with the -o option.
81
82       -x args
83       --extra-args args
84              Passes extra SSH command-line arguments (see the ssh(1) man page
85              for  more  information about SSH arguments).  This option may be
86              specified multiple times.  The arguments are processed to  split
87              on whitespace, protect text within quotes, and escape with back‐
88              slashes.  To pass arguments without such processing, use the  -X
89              option instead.
90
91       -X arg
92       --extra-arg arg
93              Passes  a  single  SSH command-line argument (see the ssh(1) man
94              page for more information about SSH arguments).  Unlike  the  -x
95              option,  no  processing  is performed on the argument, including
96              word splitting.  To pass multiple  command-line  arguments,  use
97              the option once for each argument.
98
99       -O options
100       --options options
101              SSH  options  in  the  format used in the SSH configuration file
102              (see the ssh_config(5) man page  for  more  information).   This
103              option may be specified multiple times.
104
105       -A
106       --askpass
107              Prompt  for  a password and pass it to ssh.  The password may be
108              used for either to unlock a key or for password  authentication.
109              The  password is transferred in a fairly secure manner (e.g., it
110              will not show up in argument lists).  However, be aware  that  a
111              root  user  on your system could potentially intercept the pass‐
112              word.
113
114       -i
115       --inline
116              Display standard output and standard error  as  each  host  com‐
117              pletes.
118
119       --inline-stdout
120              Display  standard  output  (but not standard error) as each host
121              completes.
122
123       -v
124       --verbose
125              Include error messages from ssh with the -i and \ options.
126
127       -I
128       --send-input
129              Read input and send to each ssh process.   Since  ssh  allows  a
130              command  script  to be sent on standard input, the -I option may
131              be used in lieu of the command argument.
132
133       -P
134       --print
135              Display output as it arrives.  This option is of limited useful‐
136              ness because output from different hosts are interleaved.
137
138

EXAMPLES

140       Connect to host1 and host2, and print "hello, world" from each:
141              pssh -i -H "host1 host2" echo "hello, world"
142
143       Print "hello, world" from each host specified in the file hosts.txt:
144              pssh -i -h hosts.txt echo "hello, world"
145
146       Run a command as root with a prompt for the root password:
147              pssh -i -h hosts.txt -A -l root echo hi
148
149       Run a long command without timing out:
150              pssh -i -h hosts.txt -t 0 sleep 10000
151
152       If  the file hosts.txt has a large number of entries, say 100, then the
153       parallelism option may also be set to 100 to ensure that  the  commands
154       are run concurrently:
155              pssh -i -h hosts.txt -p 100 -t 0 sleep 10000
156
157       Run a command without checking or saving host keys:
158              pssh  -i  -H  host1  -H host2 -x "-O StrictHostKeyChecking=no -O
159              UserKnownHostsFile=/dev/null -O  GlobalKnownHostsFile=/dev/null"
160              echo hi
161
162       Print  the  node  number for each connection (this will print 0, 1, and
163       2):
164              pssh -i -H host1 -H host1 -H host2 'echo $PSSH_NODENUM'
165

TIPS

167       If you have a set of hosts that you connect to frequently with specific
168       options, it may be helpful to create an alias such as:
169              alias pssh_servers="pssh -h /path/to/server_list.txt -l root -A"
170
171       Note  that  when  an ssh command is terminated, it does not kill remote
172       processes (OpenSSH bug #396 has been open since 2002).  One  workaround
173       is to instruct ssh to allocate a pseudo-terminal, which makes it behave
174       more like a normal interactive ssh session.  To  do  this,  use  pssh's
175       "-x" option to pass "-tt" to ssh.  For example:
176              pssh -i -x "-tt" -h hosts.txt -t 10 sleep 1000
177       will ensure that all of the sleep commands will terminate (with SIGHUP)
178       after the 10 second timeout.
179
180       By default, ssh uses full buffering for non-interactive commands.  Line
181       buffering may be preferrable to full buffering if you intend to look at
182       the files in an output directory as a command is  running.   To  switch
183       ssh  to  use  line  buffering,  use its "-tt" option (which allocates a
184       pseudo-terminal) using the "-x" option in pssh.
185
186       The ssh_config file can include an arbitrary number of  Host  sections.
187       Each  host  entry  specifies  ssh options which apply only to the given
188       host.  Host definitions can even behave like aliases  if  the  HostName
189       option  is  included.   This ssh feature, in combination with pssh host
190       files, provides a tremendous amount of flexibility.
191
192

EXIT STATUS

194       The exit status codes from pssh are as follows:
195
196       0      Success
197
198       1      Miscellaneous error
199
200       2      Syntax or usage error
201
202       3      At least one process was killed by a signal or timed out.
203
204       4      All processes completed, but at least one ssh  process  reported
205              an error (exit status 255).
206
207       5      There  were no ssh errors, but at least one remote command had a
208              non-zero exit status.
209
210

AUTHORS

212       Written by Brent N. Chun <bnc@theether.org> and  Andrew  McNabb  <amcn‐
213       abb@mcnabbs.org>.
214
215       https://github.com/lilydjwg/pssh
216
217

SEE ALSO

219       ssh(1), ssh_config(5), pscp(1), prsync(1), pslurp(1), pnuke(1),
220
221
222
223                               January 24, 2012                        pssh(1)
Impressum