Using SSH in Terminal.app on Mac OS X

The contents of this article may be out of date. It has been archived and will no longer be updated, comments are closed and the page is provided for reference purposes only.

This article will teach you how to open a SSH connection using the Terminal application in OS X. OS X's UNIX background means there is an easy way to exchange data with your Linux/UNIX web server using the built in Terminal application. SSH, if enabled, allows you to remotely execute commands on your webserver that can be helpful for all sorts of purposes.

Step 1: Adding Terminal to the dock to make things easier next time (Optional).

Open your Macintosh HD and go to the Applications folder.

Now open the Utilities folder.

Next look for the application called Terminal.

To add to your dock you just simply drag it to an empty space in the Dock.

Now, any time you want to open a Terminal window, you can do so from the Dock.

Note: If you are using Windows the rest of this article may be of interest but you will need to download a SSH client as it is not included as part of the OS. Try the free PuTTY application.

Step 2: Connecting to your server via SSH.

Start your terminal application. You will see a window with a $ symbol and a blinking cursor. This is your basic command prompt. From here you may issue the command to establish the SSH connection to your server. First we specify the type of connection ssh then our username @ the address of the server this can be a URI such as example.com or an IP Address as in 127.0.0.1.

ssh username@example.com

Immediately after issuing this command, your computer will attempt to establish a connection to your server. If it is your first time connecting to that server, you will see a message asking you to confirm the identity of the machine:

The authenticity of host ‘example.com (127.0.0.1)’ can’t be established.
RSA key fingerprint is 10:21:06:11:75:d4:1f:d1:3c:ee:0d:22:4a:13:ff:9f.
Are you sure you want to continue connecting (yes/no)?  _

Make sure you entered the address properly, and type yes, followed by the return key, to proceed.

You will then be prompted to enter your password:

user@example.com’s password: _

If you provide the correct password you will receive a message from the server, in this example from a Ubuntu install.

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
To run a command as administrator (user “root”), use “sudo <command>”.
See “man sudo_root” for details.

user@xxx: $

You are now ready to issue commands to the server.

When you are done logout of the session by typing logout then quit terminal as normal.

This article was posted on 30 October 2009 in Apple, Tutorials

That's the end of this article. I hope you found it useful. If you're enjoyed this article why don't you have a look around the archives, where you can find some more tutorials, tips and general ramblings.