Mac SSH and SFTP

Connecting to a Remote System From a Mac Using SSH or SFTP
 

About SSH and SFTP

In Mac OS X, SSH is a command-line utility designed for logging into and executing commands on a remote system (opal.ils.unc.edu for example). It is a secure replacement for telnet. SFTP is a way to transfer files in a secure manner from a remote system to a local system using the command-line.

Open a Terminal Window

Click the Terminal icon in the Dock. On other Macs, this can be found by opening a Finder, select Applications, select Utilities, and then select the Terminal icon. 

Terminal icon

Using SSH

At the prompt, type in this command:

ssh remote_username@remote_systemname

Where remote_username is your username on the system and remote_systemname is the name of the system you are connecting to (for example, onyen@opal.ils.unc.edu ). 

Terminal interface

 

Enter your password when prompted. You may also be prompted to accept a host security key. You must type "yes" to continue. 

Key prompt in the Terminal interface

 

Using SFTP

Unless you are really knowledgeable about the file structure of your computer, it is a good idea to navigate to the folder you want to transfer files into or out-of on your computer before you open a connection to a remote system. Use pwd and cd at the prompt to navigate to a suitable folder on your system. Once there, type:

sftp remote_username@remote_systemname

Where remote_username is your username on the system and remote_systemname is the name of the system you are connecting to (for example, onyen@opal.ils.unc.edu ).

Enter your password at the prompt. Now when you cd around the system, you are moving between folders on the remote system. Change to the remote folder where you will be transferring files to/from. Use put, get, mput, or mget to transfer files between the remote system and your own. Type quit to exit the SFTP session.