SSH client config file manager
https://linux.die.net/man/5/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
pip3 install ssh-config
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
$ 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
$ ssh-config add "server_cmd_4" HostName=203.0.113.77 IdentityFile="~/.ssh/cmd_id_rsa"
$ ssh-config update "server_cmd_3" IdentityFile="~/.ssh/cmd_id_rsa"
$ ssh-config remove "server_3"
ssh-config ls | xargs -I{} ssh-copy-id -i ~/.ssh/id_rsa {}
ssh-config inventory --list|--host <hostname>