Duncan Ferguson > App-ClusterSSH-4.02_04 > cssh


Annotate this POD


View/Report Bugs


cssh, crsh, ctel, ccon - Cluster administration tool


cssh [options] [[user@]<server>[:port]|<tag>] [...] crsh [options] [[user@]<server>[:port]|<tag>] [...] ctel [options] [<server>[:port]|<tag>] [...] ccon [options] [[user@]<server>[:port]|<tag>] [...]


The command opens an administration console and an xterm to all specified hosts. Any text typed into the administration console is replicated to all windows. All windows may also be typed into directly.

This tool is intended for (but not limited to) cluster administration where the same configuration or commands must be run on each node within the cluster. Performing these commands all at once via this tool ensures all nodes are kept in sync.

Connections are opened via ssh, so a correctly installed and configured ssh installation is required. If, however, the program is called by "crsh" then the rsh protocol is used (and the communications channel is insecure), or by "ctel" then telnet is used, or by "ccon" then console is used.

Extra caution should be taken when editing system files such as /etc/inet/hosts as 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 better to search for the specific line to be changed and double-check before changes are committed.

Further Notes

Please also see "KNOWN BUGS".


Some of these options may also be defined within the configuration file. Default options are shown as appropriate.

--action,-a '<command>'

Run the command in each session, e.g. -a 'vi /etc/hosts' to drop straight into a vi session. NOTE: not all communications methods support this (ssh and rsh should, telnet and console will not).

--autoclose,-K <seconds>

Number of seconds to wait before closing finished terminal windows.


Enable|Disable automatically quiting after the last client window has closed (overriding the config file)

--cluster-file,-c <file>

Use supplied file as additional cluster file (see also "FILES")

--config-file,-C <file>

Use supplied file as additional configuration file (see also "FILES")


DEPRECATED. See '--debug'.


DEPRECATED. See '--debug'.

--debug [number].

Enable debugging. Either a level can be provided or the option can be repeated multiple times. Maximum level is 4.

--evaluate,-e [user@]<hostname>[:port]

Display and evaluate the terminal and connection arguments to display any potential errors. The <hostname> is required to aid the evaluation.

--font,-f "5x8"

Specify the font to use in the terminal windows. Use standard X font notation.


Show basic help text, and exit

--list, -L

List available cluster tags.


Show full help text (the man page), and exit

--master,-M <master>

The console client program polls master as the primary server, rather than the default set at compile time (typically ``console'').

--options,-o "-x -o ConnectTimeout=10" - for ssh connections
--options,-o "" - for rsh connections

Specify arguments to be passed to ssh or rsh when making the connection.

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 (see ssh_config and $HOME/.ssh/config).


Output the current configuration in the same format used by the $HOME/.clusterssh/config file.

--port,-p <port>

Specify an alternate port for connections.


IN BETA: Show history within console window. This code is still being worked upon, but may help some users.

--tag-file,-r <file>

Use supplied file as additional tag file (see also "FILES")

--term-args,-t ""

Specify arguments to be passed to terminals being used


Enable|Disable window tiling (overriding the config file)

--title,-T "CSSH"

Specify the initial part of the title used in the console and client windows


Connect to each host only once


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,-l $LOGNAME

Specify the default username to use for connections (if different from the currently logged in user). NOTE: will be overridden by <user>@<host>


Show version information and exit


The following arguments are supported:

[user@]<hostname>[:port] ...

Open an xterm to the given hostname and connect to the administration console. An optional port number can be used if sshd is not listening on the standard port (i.e., not listening on port 22) and ssh_config cannot be used.

<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


The following key shortcuts are available within the console window, and all of them may be changed via the configuration files.


Quit the program and close all connections and windows


Open the 'Add Host(s) or Cluster(s)' dialogue box. Multiple host or cluster names can be entered, separated by spaces.


Paste in the hostname part of the specific connection string to each client, minus any username or port, i.e.

scp /etc/hosts server:files/<Alt-n>.hosts

would replace the <Alt-n> with the client's name in each window


Retile all the client windows


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 cluster 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 .ssh/config file. Do not close cssh when the last terminal exits.

$ cssh -Q user1@server1 admin@server2

Open up a cluster defined in a non-default configuration file

$ cssh -c $HOME/cssh.config db_cluster

Use telnet on port 2022 instead of ssh

$ ctel -p 2022 server1 server2

Use rsh instead of ssh

$ crsh server1 server2

Use console with master as the primary server instead of ssh

$ ccon -M master server1 server2


/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> [user@]<server> [...]


  # List of servers in live
  live admin1@server1 admin2@server2 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.

Extra cluster files may also be specified either as an option on the command line (see cluster-file) or in the user's $HOME/.clusterssh/config file (see extra_cluster_file configuration option).

NOTE: the last tag read overwrites any pre-existing tag of that name

NOTE: there is a special cluster tag called default - any tags or hosts included within this tag will be automatically opened if no other tags are specified on the command line.

/etc/tags, $HOME/.clusterssh/tags

Very similar to cluster files but the definition is reversed. The format is:

<host> <tag> [...]

This allows one host to be specified as a member of a number of tags. This format can be clearer than using clusters files.

Extra tag files may be specified either as an option (see tag-file) or within the user's $HOME/.clusterssh/config file (see extra_tag_file configuration option).

NOTE: All tags are added together

/etc/csshrc & $HOME/.clusterssh/config

This file contains configuration overrides - the defaults are as marked. Default options are overwritten first by the global file, and then by the user file.

NOTE: values for entries do not need to be quoted unless it is 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 terminal window after this many seconds. If set to 0 will instead wait on input from the user in each window before closing. Can be overridden by -K on the command line.

auto_quit = yes

Automatically quit after the last client window closes. Set to anything other than "yes" to disable. Can be overridden by -Q on the command line.

clusters = <blank>

Define a number of cluster tags in addition to (or to replace) tags defined in the /etc/clusters file. The format is:

 clusters = <tag1> <tag2> <tag3>
 <tag1> = host1 host2 host3
 <tag2> = user@host4 user@host5 host6
 <tag3> = <tag1> <tag2>

As with the /etc/clusters file, be sure not to create recursively nested tags.

comms = ssh

Sets the default communication method (initially taken from the name of the program, but can be overridden here).

console_position = <null>

Set the initial position of the console - if empty then let the window manager decide. Format is '+<x>+<y>', i.e. '+0+0' is top left hand corner of the screen, '+0-70' is bottom left hand side of screen (more or less).

external_cluster_command = <null>

Define the full path to an external command that can be used to resolve tags to 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 on a single line. Any tags that cannot be resolved should be returned unchanged.

A non-0 exit code will be counted as an error, a warning will be printed and output ignored.

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 $HOME are acceptable as a reference to the user's home directory, i.e.

 extra_cluster_file = ~/clusters, $HOME/clus

THIS OPTION IS DEPRECATED. It has been left in so current systems continue to function as expected.

key_addhost = Control-Shift-plus

Default key sequence to open AddHost menu. See below notes on shortcuts.

key_clientname = Alt-n

Default key sequence to send cssh client names to client. See below notes on shortcuts.

key_localname = Alt-l

Default key sequence to send hostname of local server to client. See below notes on shortcuts.

key_paste = Control-v

Default key sequence to paste text into the console window. See below notes on shortcuts.

key_quit = Control-q

Default key sequence to quit the program (will terminate all open windows). See below notes on shortcuts.

key_retilehosts = Alt-r

Default key sequence to retile host windows. See below notes on shortcuts.

key_username = Alt-u

Default key sequence to send username to client. See below notes on shortcuts.

macro_servername = %s
macro_hostname = %h
macro_username = %u
macro_newline = %n
macro_version = %v

Change the replacement macro used when either using a 'Send' menu item, or when pasting text into the main console.

macros_enabled = yes

Enable or disable macro replacement. Note: this affects pasting into the main console, items on the 'Send' menu and key_clientname, key_localname, key_servername and key_username.

max_addhost_menu_cluster_items = 6

Maximum number of entries in the 'Add Host' menu cluster list before scrollbars are used

max_host_menu_items = 30

Maximum number of hosts to put into the host menu before starting a new column

menu_host_autotearoff = 0
menu_send_autotearoff = 0

When set to non-0 will automatically tear-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. See below notes on shortcuts.

rsh = rsh
ssh = ssh
telnet = telnet

Set the path to the specific binary to use for the communication method, else 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 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 (see ssh_config and $HOME/.ssh/config).

screen_reserve_top = 0
screen_reserve_bottom = 60
screen_reserve_left = 0
screen_reserve_right = 0

Number of pixels from the screen's side to reserve when calculating screen geometry for tiling. Setting this to something like 50 will help keep cssh from positioning windows over your window manager's menu bar if it draws one at that side of the screen.

rsh = /path/to/rsh
ssh = /path/to/ssh

Depending on the value of comms, set the path of the communication binary.

terminal = /path/to/terminal

Path to the X-Windows terminal used for the client.

terminal_args = <blank>

Arguments to use when opening terminal windows. Otherwise takes defaults from $HOME/.Xdefaults or $<$HOME/.Xresources> file.

terminal_font = 6x13

Font to use in the terminal windows. Use standard X font notation.

terminal_reserve_top = 5
terminal_reserve_bottom = 0
terminal_reserve_left = 5
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 "-bg" and "-fg" arguments 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 to dark, the terminal background will be set to black and the foreground to the pseudo-random color. If set to light, then the foreground will be black and the background the pseudo-random color. If terminal_colorize is zero, 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 with terminal to 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 to "no" as it causes some problems with the FVWM window manager. If you are experiencing problems with redraws, you can set it to "yes" to allow the window to be unmapped before it is repositioned.

use_all_a_records = no

If a hostname resolves to multiple IP addresses, set to yes to connect to all of them, not just the first one found.

use_hotkeys = yes

Setting to anything other than yes will disable all hotkeys.

user = $LOGNAME

Sets the default user for running commands on clients.

window_tiling = yes

Perform window tiling (set to no to disable)

window_tiling_direction = right

Direction to tile windows, where "right" means 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 form "Control", "Alt", or "Shift", i.e. with the first letter capitalised and the rest lower case. Keys may also be disabled individually by setting to the word "null".


This (optional) file contains items to populate the send menu. The default entry could be written as:

    <menu title="Use Macros">
    <menu title="Remote Hostname">
    <menu title="Local Hostname">
    <menu title="Username">
    <menu title="Test Text">
        <command>echo "ClusterSSH Version: %v%n</command>

Submenus can also be specified as follows:

    <menu title="Default Entries">
      <menu title="Hostname">


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):


Hostname part of the specific connection string to each client, minus any username or port


Username part of the connection string to each client


Hostname of server where cssh is being run from


<RETURN> code

NOTE: requires XML::Simple to be installed


  1. Catering for IPv6 addresses is minimal. This is due to a conflict between IPv6 addresses and port numbers within the same server definition since they both use the same separator, i.e. is the following just an IPv6 address, or an address + port number of 2323?

    Exactly - I cannot tell either. The IPv6 address without a port is assumed in those cases where it cannot be determined and a warning is issued.

    Possible workarounds include:


    Use square brackets around the IPv6 address, i.e. [2001:db8::1428]:2323 or [2001:db8::1428:2323] as appropriate so there is no ambiguity


    Use the full IPv6 address if also using a port number - the 8th colon is assumed to be the port separator.


    Define the IPv6 address in your /etc/hosts file, DNS or other name service lookup mechanism and use the hostname instead of the address.

  2. 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)

Anyone with any good ideas to fix the above bugs is more than welcome to get in touch and/or provide a patch.



http://clusterssh.sourceforge.net/, ssh, Tk::overview, X11::Protocol, perl


A web site for comments, requests, bug reports and bug fixes/patches is available at http://clusterssh.sourceforge.net/


Duncan Ferguson, <duncan_j_ferguson at yahoo.co.uk>


Copyright 1999-2010 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.

syntax highlighting: