Awesome-Python-Scripts/SSH_Host_Adder
Nikola Dokoski (Nino) 09b7c22c26
Added an SSH host adder script, which allows you to add hosts to your ssh config file. (#76)
Co-authored-by: NinoCosmic <nikola.dokoski@cosmicdevelopment.com>
Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>
2020-03-25 16:39:56 +05:30
..
README.md Added an SSH host adder script, which allows you to add hosts to your ssh config file. (#76) 2020-03-25 16:39:56 +05:30
ssh_adder Added an SSH host adder script, which allows you to add hosts to your ssh config file. (#76) 2020-03-25 16:39:56 +05:30
ssh_adder.py Added an SSH host adder script, which allows you to add hosts to your ssh config file. (#76) 2020-03-25 16:39:56 +05:30

SSH Host adder

This is a fairly simple script which adds hosts to an ssh config file. SSH allows you to add hosts to a config file, so you don't have to remember ip addresses or hostnames. So if you add:

HOST test
    HostName 192.168.80.1
    User root
    Port 22

to ~/.ssh/config, you can just do ssh test instead of writing the address / user / port.

But when you constantly get new servers to ssh to, it's helpful to have a script!

Usage:

./ssh_adder my_host 192.168.80.1 [--user myuser] [--port 2200]

--user and --port are optional and default to root and 22 respectively.

If you aren't using the default ssh config path, there is an argument for that as well:

./ssh_adder my_host 192.168.80.1 --conf /path/to/config

-conf defaults to ~/.ssh/config

SSH configs allow you to make more complex operations, like adding different keys and whatnot, which I don't support here mostly because I haven't had a need to yet. If I get to updating my script some time, I'll update it here too.