Skip to main content

Add some magic to SSH and .ssh/config

Project description

Advanced SSH config

|Travis| |PyPI version| |PyPI downloads| |License| ||

|ASSH logo - Advanced SSH Config logo|

Enhances ``ssh_config`` file capabilities

**NOTE**: This program is called by
`ProxyCommand <>`__
from `lib-ssh <>`__.


It works *transparently* with :

- ssh
- scp
- rsync
- git
- and even desktop applications depending on ``lib-ssh`` (for instance
`Tower <>`__, ` <>`__,
`SSH Tunnel Manager <>`__)


The ``.ssh/config`` file is automatically generated, you need to update
``.ssh/config.advanced`` file instead; With new features and a better
regex engine for the hostnames.


.. code:: console

$ assh --help
Usage: assh [OPTIONS] COMMAND [arg...]

build Build .ssh/config based on .ssh/config.advanced
connect <host> Open a connection to <host>
info <host> Print connection informations
init Build a .ssh/config.advanced file based on .ssh/config
generate-etc-hosts Print a /etc/hosts file of .ssh/config.advanced
stats Print statistics

--version show program's version number and exit
-h, --help show this help message and exit
-p PORT, --port=PORT SSH port
ssh_config file
-f, --force
-v, --verbose
-l LOG_LEVEL, --log_level=LOG_LEVEL

Commmand line features

**Gateway chaining**

.. code:: bash


Connect to ```` using ssh and create a proxy on ```` to
````. Then connect to ```` using the created proxy on

.. code:: bash


Connect to ```` using ```` which itself uses

Configuration features

- **regex for hostnames**: ``*``
- **aliases**: ``gate`` -> ``gate.domain.tld``
- **gateways**: transparent ssh connections chaining
- **includes**: split configuration into multiple files, support
- **local command execution**: finally a way to execute a command
locally on connection
- **inheritance**: ``inherits = gate.domain.tld``
- **variable expansion**: ``User = $USER`` (take $USER from
- **smart proxycommand**: connect using ``netcat``, ``socat`` or custom

Config example


.. code:: ini

# Simple example
user = pacman
port = 2222

hostname =
gateways = # `ssh bar` will use `` as gateway

gateways = bar # `ssh will use `bar` as gateway which
# itself will use `` as gateway

ProxyCommand = assh --port=%p connect %h


.. code:: ini

# Complete example
user = pacman
port = 2222
hostname =

hostname =
gateways = foo
# By running `ssh bar`, you will ssh to `bar` through a `ssh foo`

IdentityFile = ~/.ssh/root-joe

gateways = direct
# Will try to ssh without proxy, then fallback to proxy, then
# fallback to through bar

DynamicForward = 43217
LocalForward = 1723 localhost:1723
ForwardX11 = yes

Includes = ~/.ssh/config.advanced2 ~/.ssh/config.advanced3 ~/.ssh/configs/*/host.config
# The `Includes` directive must be in the `[default]` section

Port = 22
User = root
IdentityFile = ~/.ssh/id_rsa
ProxyCommand = assh connect %h --port=%p
Gateways = direct
PubkeyAuthentication = yes
VisualHostKey = yes
ControlMaster = auto
ControlPath = ~/.ssh/controlmaster/%h-%p-%r.sock
EscapeChar = ~


Download the latest build

.. code:: console

$ curl -L`uname -s`-`uname -m` > /usr/local/bin/assh
$ chmod +x /usr/local/bin/assh

Using Pypi

.. code:: console

$ pip install advanced-ssh-config

Or by cloning

.. code:: console

$ git clone
$ cd advanced-ssh-config
$ make install

First run

Automatically generate a new ``.ssh/config.advanced`` based on your
current ``.ssh/config`` file:

.. code:: console

$ assh init > ~/.ssh/config.advanced
$ assh build -f


.. code:: console

$ make test



.. code:: console

$ docker build -t moul/advanced-ssh-config .


.. code:: console

$ docker run -rm -i -t moul/advanced-ssh-config
$ docker run -rm -i -t -v $(pwd)/:/advanced_ssh_config moul/advanced-ssh-config
$ docker run -rm -i -t -v moul/advanced-ssh-config python test


- `Christo DeLange <>`__


© 2009-2015 Manfred Touron - `MIT
License <>`__.

.. |Travis| image::
.. |PyPI version| image::
.. |PyPI downloads| image::
.. |License| image::
.. || image::
.. |Gitter| image::
.. |ASSH logo - Advanced SSH Config logo| image::

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

advanced-ssh-config-1.1.0.tar.gz (17.7 kB view hashes)

Uploaded Source

Built Distributions

advanced_ssh_config-1.1.0-py27-none-any.whl (25.4 kB view hashes)

Uploaded Python 2.7

advanced_ssh_config-1.1.0-py26-none-any.whl (25.4 kB view hashes)

Uploaded Python 2.6

advanced_ssh_config-1.1.0-py2.7.egg (49.4 kB view hashes)

Uploaded Source

advanced_ssh_config-1.1.0-py2.6.egg (49.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page