One of the greatest advantages of MacOS is that it is built on a UNIX based platform and includes many of its best capabilities. One such feature is a built in Mac SFTP server.
Interesting Articles
SFTP isn’t a pretty application like TimeMachine or any of the apps included in iLife. It’s a protocol that allows you to easily transfer files from one computer to another when not directly connected to it through a network. SFTP is built into MacOS and requires that you enable it with a few tweaks in System Preferences and maybe an adjustment to your home router settings.
Configure The SFTP Server On Your Mac
Enabling the SFTP server on your Mac can be done quickly by opening system preferences, selecting sharing, and then making sure the Remote Login box is checked.
More details about how to enable the SFTP server on your Mac can be found below:
- Open System Preferences and select Sharing.
- Next, make sure that Remote Login is enabled. You can allow any of the user accounts on your system to connect through remote login or you can specific specific users that you’d like to connect. If you’d like to create an account for a specific individual that doesn’t have access on your account then see additional details in the next section of this article.
With remote login enabled, the SFTP server on your Mac is enabled and you should be able to connect to your Mac with SFTP. Open any SFTP supported FTP client (We use Cyberduck) enter the IP address of your Mac, your account username to login to your Mac and your password. Be sure the port is set to 22 and click connect. If everything is working correctly you should be able to access your Mac file system and folder structure.
Next, make sure that Remote Login is enabled. You can allow any of the user accounts on your system to connect through remote login or you can specific specific users that you’d like to connect. If you’d like to create an account for a specific individual that doesn’t have access on your account then see additional details in the next section of this article.
With remote login enabled, your sftp server on your Mac is enabled and you should be able to connect to your Mac with SFTP. Open any SFTP supported FTP client (We use Cyberduck) enter your IP address, your account username to login to your Mac and your password. Be sure the port is set to 22 and click connect. If everything is working correctly you should be able to access your Mac file system and folder structure.
Adding Users to Your Mac SFTP Server
If you’d like to create a user for a guest or friend to access a file on your computer you’ll need to do the following:
Open System Preferences and select Accounts:
- Click the plus button and create a new account. Set the New Account to Standard and enter in the account credentials including username and password.
- After you create the account you’ll need to modify a few settings on the account. Select it in the Accounts window and right click on it. Select Advanced Options.
- In the Advanced Options window, be sure to set the login shell to something like /bin/sh/. Be sure that /false is not included. Set a home directory for the user. I often set it to one of my other users public folders. This will allow the individual to connect to your computer and have access to read and write to the public folder but not have the ability to look into other folders on the file system.
Now you should be able to connect with that user through SFTP by entering the account credentials into your SFTP client.
Configuring Your Router To Allow SFTP Connections On Your Mac
If you’ve followed the above steps and are still having trouble connecting to your Mac you may need to make adjustments to your router. Each router handles this slightly differently but you’ll need to set port forwarding on the router to point to the Mac that you just configured for SFTP access. Be sure that port 22 is set to forward to your internal network IP assigned to your Mac by your router (This is often something like 192.168.1.X). After your ports are configured correctly your router will direct any traffic on port 22 to your Mac and allow yourself or others to connect to your Mac via SFTP.