SSH (or Secure Shell) is a great service to enable on your Mac at home or work. This useful tool not only enables the ability to remotely access the command line interface of your Mac, but also to remotely access your files through a secure FTP (SFTP) connection, which gives you the ability to transfer files at will. Read on to find out how to transfer files between your own computers over a secure network connection using any modern FTP program.
What You’ll Need:
>> Router with Port Mapping feature (we’re using an AirPort Extreme)
>> SSH or Terminal app to access command line (We’re using the built-in Terminal app)
>> SFTP/FTP client (We’re using Transmit from Panic)
1. Get a Static IP Address on your Mac
The first step to setting up these web services on your Mac is specifying a static IP address on the Mac you’ll be connecting to. Because we’ve covered this step multiple times, we’ll point you to an article we wrote earlier that clearly outlines the process of setting up a static IP address. Follow the steps in the past article, then come back here to finish setting up SSH on your Mac.
2. Enable SSH on your Mac
Next, we’ll enable SSH on the Mac you’re going to be accessing remotely. Navigate to System Preferences > Sharing.
Once there, check the Remote Login box to enable SSH, then select the radio button labeled “All Users” from the Allow Access For section. This will in turn enable SSH for every user on the Mac. If you wish to, you can enable SSH only for select users using the other options.
3. Configure Port Mappings
Port mapping is another topic that we covered in the past. Follow the directions in the past article, while making the following changes when it comes to specifying the ports.
When opening the Port Mapping Setup Assistant (located in AirPort Utility > Manual Setup > Advanced > Add, select “Remote Login - SSH” from the Service drop-down menu. The Public and Private TCP Ports should automatically be filled in as 22. This is the default port number for SSH. The only other field that needs to be filled in is the Private IP Address. Place the Static IP Address of the Mac that you enabled SSH on.
This setting will tell the router to forward any SSH traffic (on port 22) to the Mac that you enabled SSH on.
4. Access your Mac remotely via Command line
Now that you’ve enabled SSH and configured port mapping on your router, you will be able to access your Mac’s command line and files remotely.
Open the Terminal app (/Applications/Utilities/), and type the following command, supplementing the underlined items with your own data. Note, you can find the IP Address of your Internet connection by visiting a site like IP Chicken.
After entering the above command (with your info provided), press the enter key. You will then be prompted for your account password. After you have authenticated with your password, your SSH session will be opened and be able to interact with your Mac’s command line just as though you were sitting in from of your computer.
5. Access your Mac’s files remotely via SSH
With an SFTP client (like Panic’s Transmit, or FileZilla), you can quickly access your files remotely thanks to SSH on your home or work Mac. We’re going to show you how to do the following steps using Transmit.
After opening Transmit, go to Go > Connect To... > SFTP Server. Fill in the Server, Username, and Password fields. The server should be the IP Address that you got from IP Chicken on the Mac with SSH enabled, the username and password will be the account on the Mac you’re connecting to.
After you click connect, you will be browse, download, and upload files to your Mac remotely.
Follow this article’s author, Cory Bohon on Twitter.