Use a PuTTY generated key on Mac OSX

I wanted to use the key I generated using the PuTTYGen tool on my windows laptop, on my now repaired Mac Pro. The standard PuTTY generated key will not work on Linux or Mac OSX, so the key needs to be converted into a standard that will, like OpenSSH. You can convert your key by using the ‘Export to OpenSSH’ option explained in a previous post.

Once you have your new private OpenSSH key, copy it to your Mac.

Open terminal, and go to your root… usually does this automatically, but type cd ~/ just in case.

Create a .ssh directory if it does not already exist and copy the private key in here.

You may need to check that the key has the right permissions, type chmod -R g0-rx ~/.ssh

Enter your ssh command, ssh username@serverhostname.com and hit enter, you should get now have a SSH tunnel to your server.

HANDY TIP: use the vvv flag to debug the ssh command  (looks odd but thats 3 v’s by the way!).

So type ssh username@serverhostname.com -vvv to receive a load of debug info that can be really useful in determining where you are screwing up.

Also I found this guide useful.

How to SSH into remote database from Windows

If you find yourself with a bust Mac and you have to fall back on your old ‘reliable’ windows laptop. You need to connect to your development web server using SSH, where do you start… I’ll tell you where, Google, or you may find this guide of some use.

So firstly, I need to set up PuTTY, a free and open source terminal emulator that will allow me to SSH into my remote web server.

Download PuTTY here.

Once downloaded, I need to generate a public/private key to authenticate the SSH connection from my machine to the web server.

Use another tool – PuTTYGen to generate the keys for you.

Download PuTTYGen here.

Here’s a pretty straightforward guide that I cannot be arsed to repeat on how to create the key. One difference for me was we use DSA encryption.

HANDY TIP: If you wish to use this key on a Mac (like I did once it was repaired) so that you can connect from either machine (windows or mac), then do the following.

Once you have your key created you need to export the key as an OpenSSL key and save it for later.

On with the guide…
Continue reading “How to SSH into remote database from Windows”