CSSH(1)
cssh β cluster administration tool π
okay bestie, buckle up, this is CSSH(1) from the User Contributed Perl Documentation section, and it's a big one. we're doing this in parts, so hydrate and let's go β¨
NAME π
cssh β Cluster administration tool
VERSION π¦
This documentation is for version: 4.19
SYNOPSIS π«
cssh [-a '<command>'] [-K <seconds>] [-q] [-c '<filename>'] [-x <cols>]
[-C s@] [--debug [[...] || <INTEGER>]] [-d] [-e
'<[user@]<host>[:port]>'] [--fillscreen] [-f '<font>'] [-h] [-L '[tag]']
[-M '<font>'] [-H] [--no-autoclose] [-o '<STRING>'] [-p <port>] [-P]
[-Q] [-y <rows>] [-s] [-r '<filename>'] [-t '<STRING>'] [-g] [-T
'<title>'] [-u] [-?] [-A] [-l '<username>'] [-v]
RELATED πΈ
also go read the individual man pages for each of these little utilities, they're their own whole thing:
cconβ Use 'console' as the communication methodcrshβ Use 'rsh' as the communication methodcsftpβ Use 'sftp' as the communication methodctelβ Use 'telnet' as the communication method
DESCRIPTION π
so. this command opens an administration console plus an xterm to every single host you name. anything you type into that admin console gets replicated to all the windows. and yeah, you can also type directly into any individual window if you want, no gatekeeping π
this tool is made for (but not limited to!!) cluster administration, i.e. those situations where the same config or the same commands have to run on every node in the cluster. running them all at once through this means all your nodes stay in sync. slay. no cap.
connections get opened using ssh, which has to be correctly installed and configured. non-negotiable, bestie.
π¨ extra caution should be taken when editing files, because lines may not necessarily be in the same order. assuming line 5 is the same across all servers and modifying that is dangerous. it's way better to search for the specific line you want to change and double-check all terminals are as expected before changes are committed. fr fr, this is the one that bites people.
Further Notes π§
please also see "KNOWN BUGS". (iykyk)
- the dotted line on any sub-menu is a tear-off, i.e. click on it and the sub-menu is turned into its own window β¨
- unchecking a hostname on the Hosts sub-menu will unplug the host from the cluster control window, so any text typed into the console is not sent to that host. re-selecting it will plug it back in π
- if your window manager menu bars are obscured by terminal windows, see the
"screen_reserve_XXXXX"options in the$HOME/.clusterssh/configfile (see "FILES"). - if the terminals overlap too much, see the
"terminal_reserve_XXXXX"options in the$HOME/.clusterssh/configfile (see "FILES"). - when using ClusterSSH on a large number of systems to connect to a single system using an SSH utility (e.g. you issue a command to to copy a file using
scpfrom the remote computers to a single host) and when these connections require authentication (i.e. you are going to authenticate with a password), thesshddaemon at that location may refuse connections after the number"MaxStartups"limit insshd_configis exceeded. (if this value is not set, it defaults to10). this is expected behavior;sshduses this mechanism to prevent DoS attacks from unauthenticated sources. please tunesshd_configand reload the SSH daemon, or consider using the~/.ssh/authorized_keysmechanism for authentication if you encounter this problem. π - if client windows fail to open, try running:
cssh -e {single host name}
this will test the mechanisms used to open windows to hosts. this could be due to either the -xrm terminal option which enables "AllowSendEvents" (some terminals do not require this option, other terminals have another method for enabling it β see your terminal documentation) or the configuration of ssh.
OPTIONS π
some of these options may also be defined within the configuration file. default options are shown as appropriate. periodt.
--action '<command>',-a '<command>'β run the command in each session, e.g.-a 'vi /etc/hosts'to drop straight into a vi session π₯--autoclose <seconds>,-K <seconds>β number of seconds to wait before closing finished terminal windows--autoquit,-qβ toggle automatically quitting after the last client window has closed (overriding the config file)--cluster-file '<filename>',-c '<filename>'β use supplied file as additional cluster file (see also "FILES")--cols <cols>,-x <cols>β number of columns--config-file s@,-C s@β use supplied file as additional configuration file (see also "FILES"). this option may be repeated and files are loaded in the order given π--debug [[...] || <INTEGER>]β enable debugging. either a level can be provided or the option can be repeated multiple times. maximum level is9.--dump-config,-dβ dump the current configuration in the same format used by the$HOME/.clusterssh/configfile--evaluate '<[user@]<host>[:port]>',-e '<[user@]<host>[:port]>'β display and evaluate the terminal and connection arguments to display any potential errors. the<hostname>is required to aid the evaluation.--fillscreenβ resize terminal windows to fill the whole available screen π--font '<font>',-f '<font>'β specify the font to use in the terminal windows. use standard X font notation such as"5x8".--help,-hβ show basic help text and exit--list '[tag]',-L '[tag]'β list available cluster tags. tag is optional. if a tag is provided then hosts for that tag are listed. NOTE: format of output changes when using"--quiet"or"-Q"option.--main-window-font '<font>',-M '<font>'β specify the font to use in the main console window. use Tk font notation such as"sans 14 bold".--man,-Hβ show full help text (the man page) and exit--no-autocloseβ do not close terminal windows automatically (same asauto_close = 0).--options '<STRING>',-o '<STRING>'β specify arguments to be passed to ssh when making the connection. NOTE: options for ssh should normally be put into the ssh configuration file; see"ssh_config"and$HOME/.ssh/configfor more details. Default:-x -o ConnectTimeout=10--port <port>,-p <port>β specify an alternate port for connections.--preserve-host-order,-Pβ display and tile hosts in the order given on the command line instead of alphabetically.--quiet,-Qβ do not output extra text when using some options--rows <rows>,-y <rows>β number of rows--show-history,-sβ show history within console window.--tag-file '<filename>',-r '<filename>'β use supplied file as additional tag file (see also "FILES")--term-args '<STRING>',-t '<STRING>'β specify arguments to be passed to terminals being used.--tile,-gβ toggle window tiling (overriding the config file).--title '<title>',-T '<title>'β specify the initial part of the title used in the console and client windows.--unique-servers,-uβ toggle connecting to each host only once when a hostname has been specified multiple times.--usage,-?β show synopsis and exit--use-all-a-records,-Aβ if a hostname resolves to multiple IP addresses, toggle whether or not to connect to all of them, or just the first one (see also config file entry).--username '<username>',-l '<username>'β specify the default username to use for connections (if different from the currently logged in user). NOTE: will be overridden by<user>@<host>.--version,-vβ show version information and exit
ARGUMENTS π«Ά
the following arguments are supported:
[user@]<hostname>[:port] ...β open an xterm to the given hostname and connect to the administration console. the optional port number can be used if the server is not listening on the standard port.<tag> ...β open a series of xterms defined by<tag>in one of the supplementary configuration files (see "FILES"). Note: specifying a username on a cluster tag will override any usernames defined in the cluster.
KEY SHORTCUTS β¨οΈ
the following key shortcuts are available within the console window, and all of them may be changed via the configuration files. yes, all of them π
- Control-Shift-plus β open the 'Add Host(s) or Cluster(s)' dialogue box. multiple host or cluster names can be entered, separated by spaces.
- Alt-n β paste in the hostname part of the specific connection string to each client, minus any username or port, e.g.
scp /etc/hosts server:files/<Alt-n>.hosts
would replace the <Alt-n> with the client's name in each window.
- Alt-l β paste in the hostname of the server
csshis being run on - Alt-q β quit the program and close all connections and windows.
- Alt-r β retile all the client windows.
- Alt-u β paste in the username for the connection
- Alt-1
- Alt-2
- Alt-3
- Alt-4 β run the matching user defined macro on the server and send the output to the client
EXAMPLES β
open up a session to 3 servers
$ cssh server1 server2 server3
open up a session to a cluster of servers identified by the tag 'farm1' and give the controlling window a specific title, where the tag is defined in one of the default configuration files
$ cssh -T 'Web Farm Cluster 1' farm1
connect to different servers using different login names. NOTE: this can also be achieved by setting up appropriate options in the configuration files. do not close the console when the last terminal exits.
$ cssh user1@server1 admin@server2
open up a cluster defined in a non-default configuration file
$ cssh -c $HOME/cssh.extra_clusters db_cluster
override the configured/default port to use 2022 instead
$ cssh -p 2022 server1 server2
load multiple extra configuration files; later files override earlier ones
$ cssh -C ssh -C right server1 server2
FILES π
/etc/clusters,$HOME/.clusterssh/clustersβ these files contain a list of tags to server names mappings. when any name is used on the command line it is checked to see if it is a tag. if it is a tag, then the tag is replaced with the list of servers. the format is as follows:
<tag> [user@]<server>[:port] [user@]<server>[:port] [...]
e.g.
# List of servers in live
live admin1@server1 admin2@server2:2022 server3 server4
all comments (marked by a #) and blank lines are ignored. tags may be nested, but be aware of using recursive tags as they are not checked for. π
servers can be defined using expansion macros:
"webservers websvr{a,b,c}"
would be expanded to
"webservers websvra websvrb websvrc"
and
"webservers websvr{6..9}"
would be expanded to
(...and bestie, this page keeps going β part 2 is right there π)
"webservers websvr6 websvr7 websvr8 websvr9"
okay so you can ALSO drop extra cluster files in, either as a command-line option (peep cluster-file) or in your $HOME/.clusterssh/config (peep extra_cluster_file, more on that below). π«Ά
NOTE: the last tag read overwrites any pre-existing tag of that same name. Last one in wins, bestie β no merging, no mercy. π
NOTE: there is a special cluster tag called default β anything you tuck inside that tag gets opened automatically if you don't specify anything on the command line. It's giving "surprise, you're connected". β¨
πΈ /etc/tags, $HOME/.clusterssh/tags πΈ
Super similar to clusters files except the definition is flipped, okay? The format is:
<host> <tag> [...]
So instead of "tag then hosts", it's "host then which tags it belongs to". This is the move when one host needs to be a member of a whole bunch of tags. Honestly this format can be clearer than clusters files β lowkey iconic. π
Extra tag files can come in either as an option (see tag-file) or from your $HOME/.clusterssh/config (see extra_tag_file).
NOTE: All tags are added together. Everything, all at once, no overwriting drama here. π
π /etc/csshrc & $HOME/.clusterssh/config π
This file is where you put your config overrides β the defaults are marked as we go. The defaults get overwritten first by the global file, and then by your user file. So user file always gets the last word, main character behaviour fr fr. π
NOTE: values for entries do not need to be quoted unless it's required for passing arguments, e.g.
terminal_allow_send_events="-xrm '*.VT100.allowSendEvents:true'"
should be written as
terminal_allow_send_events=-xrm '*.VT100.allowSendEvents:true'
auto_close = 5β close the terminal window after this many seconds. If you set it to0it will instead wait on input from the user in each window before closing. See also--autocloseand--no-autoclose.auto_quit = 1β automatically quit after the last client window closes. Set to0to disable. See also--autoquit.auto_wm_decoration_offsets = noβ turn on/off an alternative algorithm for calculating terminal positioning.command_pre =command_post =β wrap extra commands around the communication method. For example:
command_pre= . $HOME/virtualenvs/default/bin/active ;
command_post= | ct
would let you use Python virtual environments and then pipe all shell output through chromaterm for syntax highlighting. Note: you must use appropriate command separators/terminators to keep the meaning of the command pipeline (like ; and | between commands).
These are not put through macro parsing. π«
comms = sshβ sets the default communication method (it starts out taken from the name of the program, but you can override it right here).console_position = <null>β set the initial position of the console; if it's empty, let the window manager decide. Format is+<x>+<y>, i.e.+0+0is the top left hand corner of the screen,+0-70is the bottom left hand side of the screen (more or less). π¦external_command_mode = 0600β file mode bits for theexternal_command_pipe.external_command_pipe = <null>β define the full path to an external command pipe you can write to for controlling some aspects of ClusterSSH, like opening sessions to more clusters.
Commands:
"open <tag|hostname>"β open new sessions to the provided tag or hostname"retile"β force window retiling
e.g.:
"echo 'open localhost'" /path/to/external_command_pipe >>
external_cluster_command = <null>β define the full path to an external command that can resolve tags into host names. This command can be written in any language. The script must accept a list of tags to resolve and output a list of hosts (space separated on a single line). Any tags it can't resolve should be returned unchanged.
A non-0 exit code counts as an error β a warning gets printed and the output is ignored. π
If the external command is given a -L option it should output a list of tags (space separated on a single line) it can resolve.
extra_cluster_file = <null>β define an extra cluster file in the format of/etc/clusters. Multiple files can be specified, separated by commas. Both~and$HOMEare acceptable as a reference to the user's home directory, e.g.
extra_cluster_file = ~/clusters, $HOME/clus
extra_tag_file = <null>β define an extra tag file in the format of/etc/tags. Multiple files can be specified, separated by commas. Both~and$HOMEare acceptable as a reference to the user's home directory, e.g.
extra_tag_file = ~/tags, $HOME/tags
key_addhost = Control-Shift-plusβ default key sequence to open the AddHost menu. SeeKEY SHORTCUTSfor more. β¨οΈhide_menu = 0β if set to1, hides the menu bar (File, Hosts, Send, Help) in the console.key_clientname = Alt-nβ default key sequence to send cssh client names to the client. SeeKEY SHORTCUTS.key_localname = Alt-lβ default key sequence to send the hostname of the local server to the client. SeeKEY SHORTCUTS.key_paste = Control-vβ default key sequence to paste text into the console window. SeeKEY SHORTCUTS.key_quit = Control-qβ default key sequence to quit the program (heads up: it will terminate all open windows). SeeKEY SHORTCUTS.key_retilehosts = Alt-rβ default key sequence to retile host windows. SeeKEY SHORTCUTS.key_username = Alt-uβ default key sequence to send username to the client. SeeKEY SHORTCUTS.key_user_1 = Alt-1key_user_2 = Alt-2key_user_3 = Alt-3key_user_4 = Alt-4β default key sequence to send user defined macros to the client. If the matchingmacro_user_1macro is undefined, the sequence is passed straight to the terminal. SeeKEY SHORTCUTS.macro_servername = %smacro_hostname = %hmacro_username = %umacro_newline = %nmacro_version = %vmacro_user_1 = %1macro_user_2 = %2macro_user_3 = %3macro_user_4 = %4β change the replacement macro used when either using a 'Send' menu item, or when pasting text into the main console.macro_user_1_command =macro_user_2_command =macro_user_3_command =macro_user_4_command =β user defined macros: the macro is run through the shell on the server and the output is sent to the client. For example,
macro_user_1_command=echo echo macro_user_1
would send the text echo macro_user_1 into the terminal session. And
macro_user_1_command=env | grep CSSH
would send the CSSH environment variables to the client. π
The following environment variables are set in the shell of the macro process:
CSSH_SERVERNAMECSSH_HOSTNAMECSSH_USERNAMECSSH_CONNECTION_STRINGCSSH_CONNECTION_PORTCSSH_VERSION
macros_enabled = yesβ enable or disable macro replacement. Note: this affects all themacro_*variables above.max_addhost_menu_cluster_items = 6β maximum number of entries in the 'Add Host' menu cluster list before scrollbars get used.max_host_menu_items = 30β maximum number of hosts to put into the host menu before starting a new column.menu_host_autotearoff = 0menu_send_autotearoff = 0β when set to non-0, automatically tears off the host or send menu at program start.mouse_paste = Button-2 (middle mouse button)β default key sequence to paste text into the console window using the mouse. SeeKEY SHORTCUTS. π±οΈrsh = /path/to/rshssh = /path/to/sshtelnet = /path/to/telnetβ set the path to the specific binary to use for the communication method, otherwise it uses the first match found in$PATH.rsh_args = <blank>ssh_args = "-x -o ConnectTimeout=10"telnet_args = <blank>β sets any arguments to be used with the communication method (defaults to the ssh arguments).
NOTE: The given defaults are based on OpenSSH, not commercial ssh software.
NOTE: Any "generic" change to the method (e.g., specifying the ssh port to use) should be done in the medium's own config file (seessh_configand$HOME/.ssh/config).
screen_reserve_top = 0screen_reserve_bottom = 60screen_reserve_left = 0screen_reserve_right = 0β number of pixels from the screen's side to reserve when calculating screen geometry for tiling. Setting this to something like50will help keep cssh from positioning windows over your window manager's menu bar if it draws one at that side of the screen. πterminal = /path/to/xtermβ path to the X-Windows terminal used for the client.terminal_args = <blank>β arguments to use when opening terminal windows. Otherwise it takes defaults from$HOME/.Xdefaultsor$HOME/.Xresources.terminal_chdir = 0β when non-0, set the working directory for each terminal as perterminal_chdir_path.terminal_chdir_path = $HOME/.clusterssh/work/%sβ path to use as the working directory for each terminal whenterminal_chdiris enabled. The path provided is passed through the macro parser (see the section above onmacros_enabled).terminal_font = 6x13β font to use in the terminal windows. Use standard X font notation.main_window_font = ""β font to use in the main console window. Use Tk font notation (e.g.sans 14 bold). When empty, the default is used (on 4K+ displays, Nimbus 14). β¨terminal_reserve_top = 5β Number of pixels from the terminal's side to reserve when calculating screen geometry for tiling. Setting these will help keep cssh from positioning windows over your scroll and title bars or otherwise overlapping the windows too much. πterminal_reserve_bottom = 0β Number of pixels from the terminal's side to reserve when calculating screen geometry for tiling. Setting these will help keep cssh from positioning windows over your scroll and title bars or otherwise overlapping the windows too much.terminal_reserve_left = 5β Number of pixels from the terminal's side to reserve when calculating screen geometry for tiling. Setting these will help keep cssh from positioning windows over your scroll and title bars or otherwise overlapping the windows too much.terminal_reserve_right = 0β Number of pixels from the terminal's side to reserve when calculating screen geometry for tiling. Setting these will help keep cssh from positioning windows over your scroll and title bars or otherwise overlapping the windows too much.terminal_colorize = 1β If set to 1 (the default), then-bgand-fgarguments will be added to the terminal invocation command-line. The terminal will be colored in a pseudo-random way based on the host name; while the color of a terminal is not easily predicted, it will always be the same color for a given host name. After a while, you will recognize hosts by their characteristic terminal color. πterminal_bg_style = darkβ If set todark, the terminal background will be set to black and the foreground to the pseudo-random color. If set tolight, then the foreground will be black and the background the pseudo-random color. Ifterminal_colorizeiszero, then this option has no effect. πterminal_size = 80x24β Initial size of terminals to use. NOTE: the number of lines (24) will be decreased when resizing terminals for tiling, not the number of characters (80). πterminal_title_opt = -Tβ Option used withterminalto set the title of the window.terminal_allow_send_events = -xrm '*.VT100.allowSendEvents:true'β Option required by the terminal to allow XSendEvents to be received. π°οΈtitle = csshβ Title of windows to use for both the console and terminals.unmap_on_redraw = noβ Tell Tk to use the UnmapWindow request before redrawing terminal windows. This defaults tonoas it causes some problems with the FVWM window manager. If you are experiencing problems with redraws, you can set it toyesto allow the window to be unmapped before it is repositioned. πuse_all_a_records = 0β If a hostname resolves to multiple IP addresses, set to 1 to connect to all of them, not just the first one found. See also"--use-all-a-records"}. π₯use_hotkeys = 1β Setting to 0 will disable all hotkeys. πuse_natural_sort = 0β Windows will normally sort in alphabetical order, i.e.:host1,host11,host2. Setting to this 1 will change the sort order, i.e.:host1,host2,host11. NOTE: You must have the perl moduleSort::Naturallyinstalled. πhost_sort_command = <null>β Define an external command that reads hosts from STDIN and writes the desired host order to STDOUT (whitespace-separated). This command is used for host sorting and takes precedence overuse_natural_sort. If the command cannot be started, exits non-zero, or outputs no hosts, cssh falls back to default lexical sorting. πpreserve_host_order = 0β When set to 1, display and tile hosts in the order given on the command line instead of sorting them alphabetically. See also-P/--preserve-host-order. π¦user = $LOGNAMEβ Sets the default user for running commands on clients.window_tiling = 1β Perform window tiling (set to 0 to disable). β¨window_tiling_direction = rightβ Direction to tile windows, whererightmeans starting top left and moving right and then down, and anything else means starting bottom right and moving left and then up. π
NOTE: The key shortcut modifiers must be in the formControl,AltorShift, e.g. with the first letter capitalised and the rest lower case. Keys may also be disabled individually by setting to the wordnull.
π $HOME/.clusterssh/send_menu
This (optional) file contains items to populate the send menu. The default entry could be written as:
<send_menu>
<menu title="Use Macros">
<toggle/>
<accelerator>ALT-p</accelerator>
</menu>
<menu title="Remote Hostname">
<command>%s</command>
<accelerator>ALT-n</accelerator>
</menu>
<menu title="Local Hostname">
<command>%s</command>
<accelerator>ALT-l</accelerator>
</menu>
<menu title="Username">
<command>%u</command>
<accelerator>ALT-u</accelerator>
</menu>
<menu title="Test Text">
<command>echo "ClusterSSH Version: %v%n</command>
</menu>
</send_menu>
Submenus can also be specified as follows:
<send_menu>
<menu title="Default Entries">
<detach>yes</detach>
<menu title="Hostname">
<command>%s</command>
<accelerator>ALT-n</accelerator>
</menu>
</menu>
</send_menu>
Caveats:
- There is currently no strict format checking of this file.
- The format of the file may change in the future
- If the file exists, the default entry (Hostname) is not added
The following replacement macros are available (note: these can be changed in the configuration file):
%sβ Hostname part of the specific connection string to each client, minus any username or port%uβ Username part of the connection string to each client%hβ Hostname of server where cssh is being run from%nβRETURNcode
NOTE: requires XML::Simple to be installed. π§
π KNOWN BUGS π
If you have any ideas about how to fix the below bugs, please get in touch and/or provide a patch.
- Swapping virtual desktops can cause a redraw of all the terminal windows. This is due to a lack of distinction within Tk between switching desktops and minimising/maximising windows. Until Tk can tell the difference between the two events, there is no fix (apart from rewriting everything directly in X). π
π οΈ TROUBLESHOOTING π οΈ
If you have issues running cssh, first try:
cssh -e [user@]<hostname>[:port]
This performs two tests to confirm cssh is able to work properly with the settings provided within the $HOME/.clusterssh/config file (or internal defaults).
- Test the terminal window works with the options provided
- Test ssh works to a host with the configured arguments
Configuration options to watch for in ssh are:
- SSH doesn't understand
-o ConnectTimeout=10- remove the option from the$HOME/.clusterssh/configfile - OpenSSH-3.8 using untrusted ssh tunnels - use
-Yinstead of-Xor useForwardX11Trusted yesin$HOME/.ssh/ssh_config(if you change the default ssh options from-xto-X)
π SUPPORT AND REPORTING BUGS π
A web site for comments, requests, bug reports and bug fixes/patches is available at: <https://github.com/duncs/clusterssh>
If you require support, please run the following commands and create an issue via: <https://github.com/duncs/clusterssh/issues>
perl -V
perl -MTk -e 'print $Tk::VERSION,$/'
perl -MX11::Protocol -e 'print $X11::Protocol::VERSION,$/'
cat /etc/csshrc $HOME/.clusterssh/config
Using the debug option (--debug) will turn on debugging output. Repeat the option to increase the amount of debug. However, if possible please only use this option with one host at a time, e.g. cssh --debug <host> due to the amount of output produced (in both main and child windows). π₯
π SEE ALSO π
<https://github.com/duncs/clusterssh/wiki/>, ssh, Tk::overview, X11::Protocol, perl
βοΈ AUTHOR βοΈ
Duncan Ferguson, <duncan_j_ferguson at yahoo.co.uk>
π LICENSE AND COPYRIGHT π
Copyright 1999-2018 Duncan Ferguson.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See <http://dev.perl.org/licenses/> for more information.
okay bestie that's the whole page π this was perl v5.42.2, dated 2026-05-05, and it's literally the CSSH(1) man page. slay π
π¦ where this page comes from
- fedora 43: clusterssh 4.19-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: clusterssh 4.19-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms