Skip to main content

SSH Config

PyPI version Build Status

SSH client config file manager

What is ssh_config?

https://linux.die.net/man/5/ssh_config

Why

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.

Requirements

After 0.0.15, Python27 is not supported.

Python 3.6 or higher

Installation

pip3 install ssh-config

Usage

Usage: ssh-config [OPTIONS] COMMAND [ARGS]...

Options:
  -f, --path TEXT       [default: /Users/jonghak.choi/.ssh/config]
  --debug / --no-debug
  --version             Show the version and exit.
  --help                Show this message and exit.

Commands:
  add         Add SSH Config into config file
  attributes  Print possible attributes for Host
  gen         Generate the ssh config
  get         Get ssh config with name
  ls          Enumerate the configs
  remove
  rename
  ssh         Interative shell for Host
  update      Update the ssh Host config Attribute key=value format

Use-cases

List hosts

$ ssh-config ls
server1
server_cmd_1
server_cmd_2
server_cmd_3

$ ssh-config ls -l
server1			10.0.2.10
server_cmd_1	10.0.1.11
server_cmd_2	10.0.1.12
server_cmd_3	10.0.1.13
Add host
$ ssh-config add "server_cmd_4" HostName=203.0.113.77 IdentityFile="~/.ssh/cmd_id_rsa"
Update host
$ ssh-config update "server_cmd_3" IdentityFile="~/.ssh/cmd_id_rsa"
Remove host
$ ssh-config remove "server_3"

Using pattern to get list or update exist hosts

add ssh key to multiple servers

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

Export ssh-config to ansible inventory ini format.

https://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html?extIdCarryOver=true&sc_cid=701f2000001OH7EAAW#inventory-script-conventions

ssh-config inventory --list|--host <hostname>

Metadata

Release files for ssh-config 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ssh-config 0.1.6
File Size Uploaded
ssh_config-0.1.6.tar.gz 18.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ssh-config 0.1.6
File Interpreter ABI Platform
ssh_config-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 36.2 kB

Release files / ssh_config-0.1.6.tar.gz

Download URL ssh_config-0.1.6.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aa96740ce9b77f3c6c2b5e246397245d6f25b7fca5c5ab2a6aac1781a68e9326
BLAKE2b-256 checksum
How to use checksums
8539bd57321ec238a2ac9faca2ac5e32d96059a89e02c9fd81aae5e1611047ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / ssh_config-0.1.6-py3-none-any.whl

Download URL ssh_config-0.1.6-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6fe8b27a8230ca65d30300149ee2e0f7984f785014d78de887f537da088daa04
BLAKE2b-256 checksum
How to use checksums
a5c12613daaac6422a42f6998061182a6606f23635839f554edb45b880bcac2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.22

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.16

2 release files

0.0.14

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page