Skip to main content
PyCon US is happening May 14th-22nd in Pittsburgh, PA USA.  Learn more

Add some magic to SSH and .ssh/config

Project description

Advanced SSH config
===================

|Travis| |PyPI version| |PyPI downloads| |License| |Requires.io|
|Gitter|

|ASSH logo - Advanced SSH Config logo|

Enhances ``ssh_config`` file capabilities

**NOTE**: This program is called by
`ProxyCommand <http://en.wikibooks.org/wiki/OpenSSH/Cookbook/Proxies_and_Jump_Hosts#ProxyCommand_with_Netcat>`__
from `lib-ssh <https://www.libssh.org>`__.

--------------

It works *transparently* with :

- ssh
- scp
- rsync
- git
- and even desktop applications depending on ``lib-ssh`` (for instance
`Tower <http://www.git-tower.com>`__, `Atom.io <https://atom.io>`__,
`SSH Tunnel Manager <http://projects.tynsoe.org/fr/stm/>`__)

--------------

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.

Usage
-----

.. code:: console

asshhelpUsage:assh[OPTIONS]COMMAND[arg...]Commands:buildBuild.ssh/configbasedon.ssh/config.advancedconnect<host>Openaconnectionto<host>info<host>PrintconnectioninformationsinitBuilda.ssh/config.advancedfilebasedon.ssh/configgenerateetchostsPrinta/etc/hostsfileof.ssh/config.advancedstatsPrintstatisticsOptions:versionshowprogramsversionnumberandexith,helpshowthishelpmessageandexitpPORT,port=PORTSSHportcCONFIGFILE,config=CONFIGFILEsshconfigfilef,forcev,verboselLOGLEVEL,loglevel=LOGLEVELdryrunCommmandlinefeaturesGatewaychaining..code::bashsshfoo.com/bar.comConnecttobar.comusingsshandcreateaproxyonbar.comtofoo.com.Thenconnecttofoo.comusingthecreatedproxyonbar.com...code::bashsshfoo.com/bar.com/baz.comConnecttofoo.comusingbar.com/baz.comwhichitselfusesbaz.com.Configurationfeaturesregexforhostnames:gw.school..domain.netaliases:gate>gate.domain.tldgateways:transparentsshconnectionschainingincludes:splitconfigurationintomultiplefiles,supportglobbinglocalcommandexecution:finallyawaytoexecuteacommandlocallyonconnectioninheritance:inherits=gate.domain.tldvariableexpansion:User=USER`` (take You can't use 'macro parameter character #' in math mode]
gateways = bar # `ssh vm-42.joe.com will use `bar` as gateway which
# itself will use `foo.com` as gateway

[default]
ProxyCommand = assh --port=%p connect %h

--------------

.. code:: ini

# Complete example
[foo]
user = pacman
port = 2222
hostname = foo.com

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

[^vm-[0-9]*\.joe\.comYou can't use 'macro parameter character #' in math mode curl -L https://github.com/moul/advanced-ssh-config/releases/download/v1.1.0/assh-`uname -s`-`uname -m` > /usr/local/bin/assh
chmod+x/usr/local/bin/asshUsingPypi..code::console pip install advanced-ssh-config

Or by cloning

.. code:: console

gitclonehttps://github.com/moul/advancedsshconfig cd advanced-ssh-config
makeinstallFirstrunAutomaticallygenerateanew.ssh/config.advancedbasedonyourcurrent.ssh/configfile:..code::console assh init > ~/.ssh/config.advanced
asshbuildfTests..code::console make test

Docker
------

Build

.. code:: console

dockerbuildtmoul/advancedsshconfig.Run..code::console docker run -rm -i -t moul/advanced-ssh-config
or
dockerrunrmitv(pwd)/:/advanced_ssh_config moul/advanced-ssh-config
or
$ docker run -rm -i -t -v moul/advanced-ssh-config python setup.py test

Contributors
------------

- `Christo DeLange <https://github.com/dldinternet>`__

--

© 2009-2015 Manfred Touron - `MIT
License <https://github.com/moul/advanced-ssh-config/blob/master/License.txt>`__.

.. |Travis| image:: https://img.shields.io/travis/moul/advanced-ssh-config.svg
:target: https://travis-ci.org/moul/advanced-ssh-config
.. |PyPI version| image:: https://img.shields.io/pypi/v/advanced-ssh-config.svg
:target: https://pypi.python.org/pypi/advanced-ssh-config/
.. |PyPI downloads| image:: https://img.shields.io/pypi/dm/advanced-ssh-config.svg
:target:
.. |License| image:: https://img.shields.io/pypi/l/advanced-ssh-config.svg?style=flat
:target: https://github.com/moul/advanced-ssh-config/blob/develop/LICENSE.md
.. |Requires.io| image:: https://img.shields.io/requires/github/moul/advanced-ssh-config.svg
:target: https://requires.io/github/moul/advanced-ssh-config/requirements/
.. |Gitter| image:: https://img.shields.io/badge/chat-gitter-ff69b4.svg
:target: https://gitter.im/moul/advanced-ssh-config
.. |ASSH logo - Advanced SSH Config logo| image:: https://raw.githubusercontent.com/moul/advanced-ssh-config/develop/assets/assh.jpg
:target: https://github.com/moul/advanced-ssh-config

Supported by

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