Thursday, 29 September 2016

SSHenanigans

OK so today I have been going all over the place in order to connect to the PC currently less than 10 inches away from my feet.

Recently I have had a head cold, which as you probably know makes you just want to lie on the couch drinking honey and lemon... Unfortunately for me I had some work to do so rather than go into the office I emailed our network guy and asked him if he could give me access to the computer under my desk via SSH. Not a problem.

He suggested that I configure my ssh server to require both a key and a password. This made sense as having a key and knowing a password is better that just knowing a password or just having a key.

I set up a new ssh key using the ssh-keygen command and then copied the key to the PC under my desk and also edited the ssh_config file to include the line 'AuthenticationMethods publickey,password'

Everything worked as it should and I was able to do some work on that day.

The next day I got into work and realised I did not have the key on my main work PC that I needed to access the PC under my desk...this key was currently on my laptop at home (my head so full of mucus forgot to remind me to make a copy).

I started thinking about maybe walking home to get a copy of the key when I remembered that I had a raspberry pi at home which I could connect to via SSH. I connected to the mini server and scanned my network for my laptop (which, fortunately, I had left on while updating). I found the IP address for my laptop and connected to that via SSH. I was then able to copy the key back to my main computer and use the ssh-add command to install it. Finally I now had access to the PC under my desk *phew*..