Did you know the Mac has a native SSH client built directly into the command line? This ssh client allows for secured connections and remote logins into other machines. Unlike Windows, you won’t need a third party app to utilize SSH for connections into remote computers and devices, because ssh is built directly into Mac OS and Mac OS X – perfect!
Let’s walk through how to make an SSH connection into another computer using the native ssh client in Mac OS.
Some quick background for the unfamiliar; SSH stands for Secure SHell, and it permits making encrypted connections into other computers over a network or the broader internet. You can use the SSH client in Mac OS to connect to any other machine with an SSH server running, whether it’s on another Mac with Mac OS X, linux, unix, or Windows computer does not matter, as long as it has an SSH server running it and you have credentials, it can be connected to securely.
Using ssh is considered somewhat advanced and typically useful for remote systems administration, shell activity, server management, and other command line activity. If you have two computers on your own network you can setup an SSH server on a Mac via System Preferences quite easily, or if you’re savvy with Terminal you can enable SSH through the command line too, and try this out for yourself.*
How to Use the SSH Client on Mac
Assuming you have the remote server IP and the remote username handy, here’s all you need to do to connect via SSH in Mac OS and Mac OS X:
- Launch the Terminal application, Terminal is found in /Applications/Utilities/ directory but you can also launch it from Spotlight by hitting Command+Spacebar and typing “Terminal” and then return
- At the command prompt, enter the following ssh syntax:
- Hit the Return key to execute the command
- Optional: You may need to verify the authenticity of the host, if everything checks out type “yes” to accept a fingerprint key and connect to the SSH server, or type ‘no’ to reject it and disconnect
- Login to the remote server by entering the password for the user account you are logging into
Replace “username” with the appropriate user account of the remote machine, and “ip.address” with the IP address of the remote machine. For example:
That’s it, now you’re logged in to the remote machine via SSH.
At this point you have access to any command line functionality on the remote computer, assuming you have privileges to perform the task or execute the command. What you do once you’re connected with SSH is up to you, but as state earlier it’s intended for advanced uses like systems administration, server management, network operations, and other higher level tasks that are generally less relevant to the average computer user.
When you’re finished you can type “exit” to disconnect from the remote machine, or just close the Terminal app to close the ssh client and connection.
* Side note: you can also SSH into your own Mac this way if you juts want to try this out, but there is little point to that since launching Terminal in and of itself grants you direct shell access to the computer to begin with. But, it does offer a means of experimenting with SSH connections if you have never done so before, just use your username @ localhost or 127.0.0.1 for the IP.
By the way if you want to allow someone else to remotely SSH into YOUR Mac, you’d need to setup the native SSH server on your Mac (easy as described here) and then you’d want to add a new user account to the Mac for that person, never share your own login and password with anyone else. Keep in mind if you give someone SSH access to your Mac with an admin account, you are giving them full access to your computer, all files, apps, activity, logs, and everything else, representing complete and total remote access to the computer. The command line has a huge number of commands available and is more powerful than the familiar graphical interface (GUI) we all know and love, so you probably do not want to allow for this randomly. Anything you can do at the command line can be done through ssh, assuming appropriate user privileges – this is why it’s so widely used for systems administration and by advanced users, and much less relevant to neophytes and the less technically inclined. If you want to give someone remote access for troubleshooting purposes and you’re a novice, a better approach is to use screen sharing instead.
Want to see more SSH tips (here)? Do have any fancy SSH tricks you want to share? Do you know of a better SSH client than OpenSSH that is built into Mac OS? Let us know in the comments!