Enable Remote Login to Start SSH Server in Mac OS X

Remote Login is a feature in Mac OS X’s Sharing preferences that allow remote users to connect to a Mac in a secure fashion by using OpenSSH. Essentially, it starts an SSH server, which includes SSH, the secure replacement for telnet, SFTP, the secure replacement for FTP, and SCP, for secure copying.
The inclusion of SFTP through Remote Login also explains why Apple ditched the FTP server in Lion, they opted for the infinitely more secure SFTP option and bundled it within Sharing’s “Remote Login” option.
Using Remote Login to Start the SSH Server in Mac OS X
These instructions are the same for OS X 10.7 Lion and 10.6:
- Open System Preferences and click on “Sharing”
- Select the checkbox next to “Remote Login” to enable it, like the screenshot above
If you want to limit incoming SSH access to certain users, you can do so in the same preference panel by ticking “Only these users” and then manually adding them by clicking on the + icon. This brings up a list of Users & Groups on the Mac that you can select from. Think of this as an extra security step, although SSH by default is quite secure.
Now that the SSH server has been enabled, you can verify they have enabled, go to the Terminal and type either ‘ssh localhost’ or ‘sftp localhost’ and you should see something like this:
$ sftp localhost
The authenticity of host 'localhost (::1)' can't be established.
RSA key fingerprint is b3:42:27:4a:b6:22:86:4b:c6:21:32:47:4b:8b:18:0d.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
Password:
Connecting to localhost isn’t too useful though, and this is called Remote Login for a reason.
Connecting to the Mac’s SSH Server Remotely
Now that you have SSH up and running, connecting to it remotely is easy. The great thing about this is you can now connect to the Mac from virtually any other operating system, all you need is an SSH client. SSH clients are bundled with Mac OS X and Linux so there are no downloads necessary there, but iOS users can use Prompt and Windows users can get PuTTY (its free).
1) From the Mac functioning as an SSH Server:
- Get the Macs IP address – Go to “System Preferences” and “Network” to retrieve the IP
2) Connecting to the Mac with SSH from another computer:
- We’ll assume you’re using the Terminal in Mac OS X, so using the IP address that you just found, use the following command syntax:
- This is what it would actually look like, using paul as the username and 192.168.0.25 as the server IP:
- You will be asked to accept an RSA key to your known hosts list, so type “yes” and then you will be asked for the users password
- You’re now remotely connected to the Mac via SSH
ssh username@ip.address
ssh paul@192.168.0.25
If you want to use SFTP or SCP instead, the procedure is the same except you use ‘sftp’ or ‘scp’ as the commands instead. Additionally, you can use SFTP from apps like CyberDuck, Transmit, or from Mac OS X itself to transfer files to and from the Mac from any other location.
A few things to remember here: your local IP address (on a LAN) is different than your external IP address (to the outside world). The easiest way to get a machines external IP is by going to a site like ‘whatismyip.org’ but keep in mind that if the Mac is behind a router with a firewall, you would have to open the ports on the router to be able to access it. That process is different depending on the router and firewall in use, so it wouldn’t make much sense to cover it here.
Finally, if you don’t mind the whole jailbrake thing, you can actually SSH into iPhones and iPads too by setting up servers on iOS devices, but it’s a bit more complicated.
Thanks to Izdexic for the post idea via comments

[...] Update: Our much more detailed guide on Remote Login and SSH Server’s is here. [...]
I have this enabled at home so I can tunnel my traffic through it from public wifi spots, works like a charm.
BTW this is a great app for making it easy:
http://projects.tynsoe.org/en/stm/
Nice tip. Here’s how to make a quick SSH Proxy with Firefox:
Setup client:
ssh -C2qTnN -D 8080 user@ssh_server
Now go to Firefox -> Preferences -> Advanced -> Network Settings and fill it in with SSH server info
Test it, check IP, done!
[...] for several reasons. For one, the command line aspect makes it easy to use through a remote SSH connection, but perhaps more useful is dd’s low-level functionality which is generally faster than [...]
[...] SSH and the Terminal and is more advanced than the email method mentioned below. You will need to enable SSH server on the target Mac beforehand for this to work, this can be done quickly through System Preferences > Network > Enable [...]
[...] the default shell in Terminal app, in addition to changing a users default login shell for when logging in remotely with SSH or otherwise. Here’s how to do [...]