Both administrators and power users who are used to configuring unix-based systems via the terminal will be right at home when using OS X, especially with OS X’s support for remote login that allows you to access your Mac using the Secure Shell (SSH) service that is common on many unix-based systems. However, while common, there are ways to connect with SSH that you might not know about.
Setting up access with SSH on your Mac is easy, and simply requires you check the Remote Login service in the Sharing system preferences, followed by optionally specifying user accounts that can use this service (administrative accounts are granted access by default).
When done, you now have several options for accessing your Mac through the command line, some of which may have benefits and conveniences over others.
The most basic approach for connecting via SSH is to use a system’s IP address; however, this can have its frustrations. Not only can it be difficult to remember which IP address is for what computer (provided you have more than one), but often IP addresses are on private networks and can change if dynamically issued. This means that unless your network is set up to route SSH traffic to your system, then you could have a hard time connecting. Nevertheless, in a simple networking environment where you know the desired IP address, using it is the quickest way to resolve a route to your computer.
Local Network Name
Back To My Mac Domain Tree
The above options are best for when logging into your Mac from the same local network; however, there may be times when you would like to log in from another network, such as if you are on Wi-Fi at a local cafe. In these cases, you can use iCloud and Apple’s Back To My Mac service to assemble a URL that will point you to your Mac. First, ensure your current Mac and the one you leave at home (or elsewhere) are both logged into your iCloud account, and then you can open the Terminal on either and run the following command:
The output for this command will give you a hierarchical tree of the domains used for accessing your Macs through iCloud, and will look like the following:
icloud.com - > btmm - - > members - - - > NUMBER
This tree specifies the address to your iCloud account (the NUMBER being your unique iCloud member ID), which can be designated as a URL by assembling the domains in reverse order, such as the following:
Note that above this entry, you will see another that simply states “local” as the domain. This is the one I mentioned above where you simply used “.local” as a suffix for your Mac’s computer name when connecting on a local network. In a similar manner, you can use the Back To My Mac account domain tree as a suffix for your computer name to connect from anywhere on the internet, so to connect to the computer “Topher’s Laptop” you would use a name similar to the following, assuming “12345678” is the iCloud member ID:
This URL should allow you to connect to your Mac from any network (local or remote), provided there are no odd firewall rules blocking your access.
Apple’s Back To My Mac service and the domain tree it establishes are unique in that they work with Apple’s Bonjour zero-configuration networking technology. This means that services like File Sharing and Screen Sharing can be automatically discovered and used seamlessly as long as there is an unhindered path between two computers. This means once you have iCloud set up, then regardless of where you are, you can access these sharing services on your other Macs by selecting them in the Finder sidebar.
While these are commonly used for services like File and Screen sharing, you can also use Bonjour to remotely login to your Mac via SSH. However, since the Finder does not support SSH connectivity, you will need to use a separate program that does. One of these that is included in OS X is the Terminal utility.
Therefore, at any time, and at any location, you can open the Terminal on the Mac you have with you, and then choose New Remote Connection from the Shell menu (or press Shift-Command-K), followed by selecting Secure Shell from the list of services. This will result in your Macs with SSH enabled showing up in the Discovered Servers list, which you can then select and connect with.
What is the best GUI application for SSH on Mac?
Depending on your definition of “best”, Terminal would qualify. It meets all my needs, is free and is included in OS X.