Enabling remote logins

Before connecting to your Macintosh remotely, you need to permit the Mac to receive SSH connections by enabling the Remote Login feature. Be aware that Remote Login and SSH can potentially expose your Macintosh to intruders; however, SSH is considered an industry-standard secure technology by corporations worldwide, so it’s a pretty common choice for remote access.[25]

To enable Remote Login on your Mac:

  1. Launch the System Preferences application.

  2. Click the Sharing icon, and unlock the Sharing Preferences if needed (you’ll be prompted for an administrator username and password).

  3. Locate the checkbox Remote Login and check it. This immediately launches an SSH server in the background.

  4. In the Allow access section, select either All users or Only these users, depending on what you want. If the latter, list the users who may access this Mac remotely.

  5. Exit the System Preferences application. The SSH server is running and will automatically start up each time you boot your Mac. To disable it, uncheck Remote Login.

To test that Remote Login is working, open Terminal and type the following command, which connects from your Mac back to itself using SSH:

ssh localhost

If you see this scary-looking message, enter “yes”:[26]

The authenticity of host 'localhost' can't be established.
RSA key fingerprint is 0a:41:c6:ef:66:38:4c:d2:91:e1:...
Are you sure you want to continue connecting (yes/no)? yes

This message, which should disappear once you’ve typed “yes,” also means Remote Login ...

Get Macintosh Terminal Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.