Logging in remotely with SSH

Once your Macintosh has Remote Login enabled, try logging into it from another computer. From a Macintosh or a Linux machine, run this command:

ssh username@hostname

where username is your username on the destination (your Macintosh), and hostname is its hostname or IP address. Enter your password (on the destination Mac) when prompted by SSH, and then you should see a shell prompt.[27]You are remotely logged in to your Mac! Go ahead and type some commands. When you’re finished, type ^D or exit to end the shell, logging yourself out and terminating the SSH connection. We discuss the ssh command in more detail in Network Connections.

To connect from a Windows PC to your Macintosh via SSH, you’ll need an SSH client program for Windows. A simple, free program is PuTTY, which you can download from http://www.chiark.greenend.org.uk/~sgtatham/putty/. Provide the hostname of your Macintosh to PuTTY, you’ll be prompted for your Mac username and password, and then a shell will run.

[27] You might also see another “RSA key fingerprint” warning, as in Enabling remote logins. If you’re positive that you’re connecting to your Mac, and not an intruder’s machine, you can dismiss this warning as well.

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.