My home iMac is connected directly to my modem via ethernet. File Sharing is turned on.

If I turn on Internet Sharing and connect my Macbook to the resulting wifi network, I can access files on my iMac via FinderGoConnect to Serversmb://<my iMac's internal IP>

Since my iMac is connected directly to my modem, I should be able to use the same process to connect from work. I open Finder and type smb://<my home's external IP> Unfortunately, this leads to an error message ("There was a problem connecting to the server.")

Interestingly, my iMac also has screen sharing enabled. Unlike SMB, this works properly from both home and work.

How can I make SMB work over WAN?

Edit: Despite some security concerns that were raised in the comments, I would still like to know how to do this! I'm actively researching possible risks, but haven't found anything specific, and it's out of scope on this site. I want this to work natively in Finder.

  • Small addendum I want to quickly note: My "iMac" is actually a self-built Hackintosh Desktop. This should however be completely irrelevant to the actual question. Aug 11, 2017 at 15:57
  • 2
    You never want to have SMB visible through a gateway. No, no, no. Think of another method... any other method.
    – Tetsujin
    Aug 11, 2017 at 16:07
  • @Tetsujin Even with a very strong password on it? Aug 11, 2017 at 16:07
  • Have you heard of WannaCry?
    – Tetsujin
    Aug 11, 2017 at 16:07
  • But WannaCry was due to a Windows vulnerability, no? I'm doing some research now but I'm not understanding how allowing remote smb connections is worse than any other protocol (sftp, etc). My work has a company SMB server which is accessible from off site... do I need to get our IT director to switch that off? Aug 11, 2017 at 16:21

1 Answer 1


As suspected by @klanomath in the comments (thank you!), the problem was that my ISP, Time Warner Cable, blocks port 445.

The solution was to change macOS's SMB listening port, which can be adjusted by editing /etc/services. Open the file and scroll down until you find two lines that read:

microsoft-ds    445/udp     # Microsoft-DS
microsoft-ds    445/tcp     # Microsoft-DS

On both lines, change 445 to a different, unused port. Save and reboot your computer. From now on, you will need to append :port-number to the end of your IP address whenever you connect to your Mac via SMB.

Potential security issues aside, this solution feels very "clean" and allows me connect to my iMac via Finder, whereas a protocol such as sftp would require 3rd party software. While my own research has not turned up any concrete security risks affecting the latest version of macOS, anyone opening SMB to WAN should be sure to set a very strong password on their user account.

Credit to this answer on Superuser for pointing me in the right direction.

†If you opened the file in TextEdit or a similar graphical program, you may get a permissions error when you try to save. Either save in a different location and copy to /etc/ manually, or use sudo nano to avoid the problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .