How to: Create an SSH connection using Terminal on Mac OS X & save the configuration for later use / shortcut

How to: Create an SSH connection using Terminal on Mac OS X & save the configuration for later use / shortcut

So now that I bought myself a new Mac I decided I would try to avoid by all means installing Windows on it. I use a lot of applications (and some games) that either only run on Windows or they work better on Windows. Sadly one of them is Putty (SSH client). I really liked how I could save different profiles for the different servers I connect to and overall the GUI to control tunnels, duplicate settings, etc. Clearly all I knew how to do on a mac was SSH ServerName boom! So finally I took some time to learn how to use all the SSH goodies on a Mac:

I. The Command Line

There are a few basic things you should know before we get into the cooler stuff. I say this because you always want to know how to perform any task two different ways. helps you troubleshooting in case one does not wok. In my case the configuration /shortcut file was in the wrong location and I knew right away because the command line worked that the problem was on the config file. But I digress. The ssh command line has several parameters but we’ll cover just a few to get you started:

-i

is used to indicate the identity file location. This is the location where you save that key file to authenticate to the server. One thing to keep in mind is that this file needs to be somewhat secured for OSX to even let you use it. Here is an example:

Permissions 0777 for ‘/Users/CloudIngenium/Documents/.SSL/Open SSH Key.txt’ are too open.

It is required that your private key files are NOT accessible by others.

This private key will be ignored.

bad permissions: ignore key: /Users/CloudIngenium/Documents/.SSL/Open SSH Key.txt

What’s recommended in this case is that you chmod the file (if not the entire directory if you use it exclusively for that purpose) to 600 or 400.

-l

is used to specify the user you want to connect to as. Think ‘root’ or your actual username.

-p

is used to specify the port. If your server does not run on the default port 22 you can specify another one here.

So in summary, you can use something like this:

ssh –i deployment_ssh_key.cert –l root -p 12345 <IP>

II. Saved Configuration / Shortcut method

Now on to the really exciting part.

You may also like...

1 Response

  1. been trying to connect SSH for a months now. thanks to this! it works well.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.