Thursday, 10 December 2015

Setting up RSA keys for SSH

SSH is a wonderful thing. It allows us to emulate a terminal window, while being at a computer the other side of the world. I guess that's why so many people around the world use it everyday.

general syntax for connecting via ssh is ssh [parameters] username@domain.com

While this is very easy to remember, if you use this a lot it can get a bit tiresome. So to make it even easier we can set up a key pair that means we no longer have to put the password in. To do this, I followed the instructions on this website:

https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2

The good thing is, now I can also automate ssh connections using bash scripts, without having to type the password in every time. It also means peaking eyes don't get a chance to see me type the password either!

Applying this:

If we look at this script, we can now see an example of just how useful it is. 

As the credentials are securely stored we can connect to 'username@domain' without putting any credentials in. The automation means that this is done ever 2 minutes (120 seconds). I can now logon to 'username@domain' and will be able to establish a connection from anywhere. 

This is really useful as if I needed physical access to a network, it would be possible for me to put a little linux machine that reverses off my own server so I could connect remotely. 

No comments:

Post a Comment