Skip to main content

ssh client config manager

Project description

SSH Config

PyPI version Build Status

SSH client config file manager

What is ssh_config?


I don't remember all the servers I am managing. Also all servers require all different configurations to connect to it. I know ~.ssh/config can handle this kind of issue. I want it to handle this file easier.

Yes, I am not sure this is easier way to handle it. but I am trying.


After 0.0.15, Python27 is not supported.

Python 3.6 or higher


$ pip install ssh-config


ssh-config <version>

       ssh-config [options] <command> [<args>...]

       -h --help           Show this screen.
       -v --version        Show version.
       -V --verbose        Verbose output
       -f --config FILE    Specify an ssh client file [default: ~/.ssh/config]

       gen         Generate ssh config file
       ls          Show list of Hosts in client file
       get         Get ssh client config with Name
       add         Add new Host configuration
       update      Update host configuration
       rename      Update host configuration
       rm          Remove exist Host configuration
       import      Import Hosts from csv file to SSH Client config
       export      Export Hosts to csv/ansible format
       bastion     Bastion register/use
       ping        Send ping to selected host
       version     Show version information


List hosts

$ ssh-config ls
# It shows name and HostName attribute
*: None
Add host
$ ssh-config add "server_cmd_4" HostName= IdentityFile="~/.ssh/cmd_id_rsa"
Update host
$ ssh-config add --update -p "server_cmd_3" IdentityFile="~/.ssh/cmd_id_rsa"
Remove host
$ ssh-config rm "server_3"

Using pattern to get list or update exist hosts

List hosts with pattern
$ ssh-config ls "server_*"
# It shows name and HostName attribute
Update hosts with pattern
$ ssh-config add --update -p "server_*" IdentityFile="~/.ssh/cmd_id_rsa"

add ssh key to multiple servers

ssh-config ls --only-name | xargs -I{} ssh-copy-id -i ~/.ssh/id_rsa {}

Export ssh-config to ansible inventory ini format.

ssh-config export ansible -g linux

server1              ansible_host=       
server_cmd_1         ansible_host=       
server_cmd_2         ansible_host=         ansible_user=user     
server_cmd_3         ansible_host=         ansible_user=user     

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

ssh_config-0.1.0.tar.gz (14.6 kB view hashes)

Uploaded source

Built Distribution

ssh_config-0.1.0-py3-none-any.whl (15.8 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page