tssh - tmux cluster ssh
tssh [-w number] [-f] [-v] [-h] [-p] [-d delay_time] [-c remote_cmd] [-o ssh_option] <host1> <host2> <clusterssh class>... <hostM>- <hostN>+
tssh can be use to launch terminal on many computer in parallel with tmux multiplexer and ssh. The tmux windows is splitted automatically. If you need more computers on the same windows, you can zoom in and out under gnome terminal with Ctrl- or Ctrl+. This must be done before launching tssh.
On the command line, you can put host
, login@host
, clusterssh class
. A host or a class can be remove from the list with a dash append and force to be in this one with a plus append.
See some Example below.
The control command for tmux
is Ctrl^b
. You can switch from broadcast to a local machine with Ctrl^b Ctrl^b
and move between machine with Ctrl^b ArrowKey
.
-w number
Windows to open (integer, default 16)
-o ssh_option
Option to pass to ssh
-f
Fast, no nmap scan to eliminate sleeping computer
-d delay_time
When use tmux
context, add a small delay in second before lauching the second shell to let tmux
the time to open the window (default 0.8).
-c remote_cmd
Launch the remote command on hosts and exit
-p
Launch in parallel (only with option -c
) with command parallel or xargs
-v
Verbose
-h
Minimal help
The clusterssh config file ~/.csshrc is a key values file. The "clusters" is mandatory for clusterssh (not tssh) and define the other keys. Values could be computer list or other key...
clusters = all server s1 s2 s3 node n1 n2 team switch
all = server node team
server = s1 s2
node = n1 n2
s1 = srv-mail srv-dns srv-imap
s2 = srv-web srv-proxy
n1 = node001 node002 node003 node004
n2 = node101 node102 node103 node104
team = pc01 pc06 laptop04 laptop05 laptop09
switch = root@switch01 root@switch05 root@switch17
The tssh
config file (~/.config/tssh/config.sh) can be use change the default parameters.
#export delay_time=0.8
#export split_number=16
export dyn_domain='mycompagny.local'
#export ssh_option=''
#export fast='yes'
#export verbose='yes'
delay_time
See option -d
.
split_number
See option -w
.
dyn_domain
If computer doesn't respond on it's normal IP, search also to connect on it with this DNS domain. Could be use with DNS dynamic domain where computer register inside automatically.
ssh_option
See option -o
.
fast
See option -f
.
verbose
See option -v
.
Example with the cluster ssh config above:
tssh all team- node005 laptop04+
Is equivalent to:
tssh srv-mail srv-dns srv-imap srv-web srv-proxy \\
node001 node002 node003 node004 \\
node101 node102 node103 node104 \\
node005 laptop04
Batch mode with tmux
tssh -c 'sudo apt-get update' all team
Batch mode with parallel
or xargs
(without tmux
)
tssh -c 'sudo apt-get update' -p all team
Connexion without the ssh key
tssh -o '-F /dev/null' all team
On Debian, you need the package
apt-get install tmux ncurses-bin wamerican nmap
wamerican
(or wfrench
...) is used to choose a random word in the file /usr/share/dict/words for each new tmux session.
ncurses-bin
is required for the tput
command to automatically split your terminal into several small panels. nmap
is only used for dynamic DNS domain and dynamic scan. This is not mandatory for general use.
By default, tssh
use tput
to know the number of columns and lines of your terminal. It takes 10 lines and 40 columns for each windows by default. If tput
is not installed, the default is 16 windows...
cluster-ssh, cssh, xargs, parallel, tmux
Own project ressources:
Written by Gabriel Moreau, Grenoble - France
Copyright (C) 2014-2019, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France Licence : GNU GPL version 2 or later