With Mac OS X Yosemite's built-in Sharing capabilities, using Secure Shell is easier than you may think. Enable your Mac's Remote Login feature to turn your Mac into an SSH server and access it remotely from another computer. You can even access your Mac from iOS and Android smartphones and tablets.
What is Remote Login
Remote Login has been one of Mac OS X's built-in Sharing features since Snow Leopard's release in 2009. It allows other computers to connect to a Mac and issue commands using SSH -- a network protocol based on a client-server model that creates a secure line of communication between two or more computers. The server's job is to listen for and accept incoming connection requests initiated by clients. SSH clients can manage the server's file system, install software, start system processes and more.
Enable Remote Login
To enable Remote Login:
Step 1: Open your Mac's "System Preferences" and click "Sharing."
Step 2: Click the box beside "Remote Login."
Step 3: Choose who can have access. You can allow access for all users or a specific list of users. To add users to the list, click the bubble beside "Only these users:," and then click the "Add" button to select a user. "Users & Groups" contains a list of your Mac's system users. "Network Users" and "Network Groups" contain a list of other computers on your network.
Step 4: Make note of your Mac's SSH login information located below the "Remote Login: On" indicator light. This contains your Mac's username and IP address separated by an "@" symbol.
Connect to Your Mac Remotely
To connect to your Mac remotely:
Step 1: From a different Mac, open a new "Finder" window, select "Applications" and open the "Utilities" folder.
Step 2: Open the "Terminal" application. The Terminal application is native only to Mac OS X. You'll need a third party SSH client application if you're using a smartphone, tablet, or Windows PC.
Step 3: In the Terminal window, enter your Mac's SSH login information. Type "yes" to confirm the connection. Enter the remote Mac's password.
Connect to Your Mac From an iOS or Android Device
You can easily connect to your Mac from iOS and Android smartphones and tablets using an SSH client app. Below is a list of free SSH client apps.
iOS SSH Client Apps
Android SSH Client Apps
Connect to Your Mac From Anywhere
You can use SSH to connect to your Mac from anywhere in the world if your network's router has been configured for port forwarding -- a network configuration used to make a computer accessible from outside of its local network. Enable port forwarding for port 22 on your router and set the forwarding address as your Mac's local IP address. Use your network's external IP address -- assigned to you by your Internet service provider -- with your SSH login information to connect to your Mac. You can easily obtain your external IP address using the What Is My IP website -- a free online IP address locator. Use the PortForward website to find a step-by-step port forwarding guide for your router.
Tips and Warnings
To help prevent unauthorized logins, always protect your Mac with a strong password.
SSH clients have access to your Mac's entire filesystem by default.
Port 22 is responsible for allowing and blocking SSH connections. Allowing port forwarding for port 22 creates an opening in your network's firewall -- a system designed to block incoming connections that originate from outside your local network.
Disable port forwarding when it isn't being used to help keep your network secure.