Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use Connect to Server to connect to anywhere Network
For years I had thought that the Finder's Go » Connect To Server (Command-K) feature only worked on the local network. I discovered, almost by accident, that if I know the IP address and user password of a Mac anywhere in the world, I can connect to it (assuming it has sharing enabled) using Connect to Server, and transfer files to/from to my heart's content.

This has been very useful when I'm working from home and need a file located on my work computer. Of course, that also means anyone else could do the same, which is a good reason to maintain a robust password!
  • Currently 2.14 / 5
  You rated: 3 / 5 (7 votes cast)

Use Connect to Server to connect to anywhere | 14 comments | Create New Account
Click here to return to the 'Use Connect to Server to connect to anywhere' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use Connect to Server to connect to anywhere
Authored by: comboprime on Mar 01, '07 08:03:51AM
I used to do that. . . . Turn on Personal File Sharing, or AFP--Apple File Protocol, I think--on my home server, then easily mount it on my laptop wherever I was. More recently, I've come to the impression that AFP is very insecure.

Instead, I turned off AFP and turned on SSH. I configured SSH to *not* allow password authentication and only accept public key/DSA passphrase. Then I use SSH Agent [link:] to create an SSH tunnel before creating an AFP connection inside that.

I'm not an expert, so someone may have even better advice. This adds an extra step, but I believe it's much more secure.

[ Reply to This | # ]
Use Connect to Server to connect to anywhere
Authored by: mckrutsch on Mar 01, '07 08:53:19AM

You can also use this technique to connect to Windows servers running either the SMB or CIFS protocols. I routinely use this to connect to servers at work from my Mac.

[ Reply to This | # ]
Use Connect to Server to connect to anywhere
Authored by: landis on Mar 01, '07 11:18:14AM

Any links to some explicit directions on how to do this? I've been using AFP routinely to connect to my home computer with a dyndns domain. I'd much appreciate making this more secure, but never have had luck figuring out the SSH method on my own. I need a hand to hold.... :(

[ Reply to This | # ]
AFP over SSH Tunnel
Authored by: comboprime on Mar 02, '07 11:28:52AM
> Any links to some explicit directions on how to do this?

First off, I should clarify my above comment: AFP is turned off at the *router*, not on my home server.

Set up is:

1) On home server's System Preferences > Sharing, turn on "Personal File Sharing" (aka Apple File Protocol, or AFP) and "Remote Login" (aka Secure SHell, or SSH). The firewall should automatically allow these connections, but it doesn't hurt to verify.

2) On your home server, open /etc/sshd_config and make the changes outlined here [link:] (basically turning off password authentication, root access, etc.).

3) On home router, disable AFP port forwarding. Computers outside the LAN will not be able to connect to your home server via AFP. (Inside will still work if you use the LAN IP, for example, Go To Server > afp://

4) On home router, enable SSH port forwarding to the server.

5) Generate a public key for your remote computer. There's a great article here [link:] but be warned that it's long. Open Terminal and enter ssh-keygen -t dsa. When it asks for a passphrase, enter a really secure one. Accept the default file locations.

6) Add your remote computer's public key to your home server. The public key is a file in a hidden folder of your user directory: ~/.ssh/ (note the period before ssh). Copy its contents (the key), and paste into your home server's ~/.ssh/authorized_keys file (create if necessary). More info here [link:]

6) Get SSH Agent [link:] and install. Create a DSA identity and set it to be the Default. Select File > New Tunnel and fill in Local Port:10548, user:your-user-name-on-server, Tunnel Host:server-ip-address, Tunnel Port:22, Remote Host:, Remote Port:548. Click File > Save, and save with a name like "AFP Tunnel."

7) When you're ready to connect, double-click the AFP Tunnel file to open SSH Agent. Enter your passphrase when requested--if you leave the SSH Agent running, you'll only have to enter it once no matter how often you connect or disconnect. Click "Open" in the SSH Agent dialog to start the tunnel.

8) Switch to the Finder and hit Cmd+K (or select Go > Connect to Server). For Server Address, enter afp://localhost:10548. Save it to your favorites, hit Enter, and you're in! (Hopefully.)

Apparently I don't understand how to use BB code tags. Sorry about that.

[ Reply to This | # ]
AFP over SSH Tunnel
Authored by: landis on Mar 02, '07 02:24:32PM
Now this should definitely be a standalone hint. Thank you so much!

I could still use a little more help tho. I've gone through the steps and can't get it to work. To check things I tried to SSH from my laptop (REMOTE) to my desktop (SERVER) going through the dyndns URL. This is what keeps popping up on the laptop:

REMOTE:~ landis$ ssh
The RSA host key for has changed,
and the key for the according IP address
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /Users/landis/.ssh/known_hosts to get rid of this message.
Offending key in /Users/landis/.ssh/known_hosts:1
RSA host key for has changed and you have requested strict checking.
Host key verification failed.

Items in italics have been changed to avoid posting anything I shouldn't.

Any ideas?

[ Reply to This | # ]

AFP over SSH Tunnel
Authored by: comboprime on Mar 02, '07 04:44:06PM
Hmmm . . . not sure exactly what's going on, but the culprit seems to be these lines:

Add correct host key in /Users/landis/.ssh/known_hosts to get rid of this message.
Offending key in /Users/landis/.ssh/known_hosts:1

See explanation here [link:]

[ Reply to This | # ]
AFP over SSH Tunnel
Authored by: jms1 on Mar 02, '07 11:25:57PM

two things are going on.

first, the "host key" for your server (the machine you're trying to connect TO) has changed. this can happen if the machine's OS had been re-installed since the last time you ssh'd into it from this client machine, or if the host key was explicitly changed for some reason.

second, the IP address of your server has changed. if the server doesn't have a static IP (which i suspect is the case, because of the "dyndns" name) then this is to be expected.

if possible, watch the logs on the server while trying to ssh into it from this client. when you issue the ssh command on the client, the server's log file should show an incoming ssh connection from the client's IP address. if it doesn't show this but the client is still getting a response from "something", then either you're looking at the wrong log file, or sshd's logging on the server was disabled somehow, or you are indeed connecting to the wrong server (which is the danger it's trying to warn you about.)

as a testing option, you may want to issue the ssh command using the server's IP address instead of the name, after verifying the server's IP address through other means. this way you can be sure that there are no DNS issues which may be causing problems (like somebody hacking the dyndns servers to make your server's name point to the wrong IP address.)

[ Reply to This | # ]
Use Connect to Server to connect to anywhere
Authored by: TiVoFan on Mar 01, '07 09:36:18AM
This works for "ftp://"; servers as well.

Am I right in thinking that I can't really use this hint if my home Macs connect to my ISP using DHCP, so my home IP address isn't static? (Plus there an Airport Extreme with NAT turned on, and no ports are forwarded to any of my Macs.)

On the plus side, I think this makes me a bit more secure. This will motivate me to disable the root user when I'm not actually using it!

I suppose I could always write a rule and an AppleScript to email me the current home IP address.

[ Reply to This | # ]
Use Connect to Server to connect to anywhere
Authored by: Oceanhints1 on Mar 01, '07 10:42:02AM
Have a look at

This will help with the dynamic ip issue.

[ Reply to This | # ]
Use Connect to Server to connect to anywhere
Authored by: sdrubbins on Mar 02, '07 10:38:55AM

I have a dynamic IP, but my ISP gives me a static text URL that I can always use to connect to the computer. (I don't know if every ISP does this.) You can find this URL in one of the sharing panes in Sys Prefs, near where you can find your IP address.

If you have this, then you can use it with the "connect to server" command, and also with SSH, FTP, Rsync, etc. It's as good as a static IP address, even when the IP address underlying it is dynamic.

BUT: while you can serve web pages from that URL, as far as I know if you want to register a domain, the new domain must be attached to a real IP address, which means you have to use DynDNS or NoIP or the like.

AND: while I called it 'static,' it's not really. If my cable modem loses its connection and must be reset, then it will create a new URL. But as long as the connection stays up it will effectively be static (mine's been the same for over two years now).

(Hmm, this might be a good hint all on its own...)

[ Reply to This | # ]
Use Connect to Server to connect to anywhere
Authored by: fube on Mar 01, '07 09:40:28AM

One nice bonus of remote disk mounting (as long as the remote host network upload speed is reasonably fast) is to listen to your itunes library remotely.

[ Reply to This | # ]
Use Connect to Server to connect to anywhere
Authored by: jonnycrunch on Mar 01, '07 12:08:06PM

Great hint! I have used a modification of a prior hint to tunnel Connect to server (Command - K) via SSH for a while.
Also by disallowing password access for SSH and using a ssh-key along with SSH-agent.
It is very secure, as even though i have personal file sharing turned on my 'server', it is behind NAT with port forwarding only for SSH over a non-standard port (ie 3022 rather than the standard 22).

After creaing the tunnel via SSH in the terminal using:
ssh -L 1548: server_name

I then Connect to server (Command -K) and point to

Thus mounting the remote Volumes in the finder.

Thanks rob for this great site!

[ Reply to This | # ]
Use Connect to Server to connect to anywhere
Authored by: phunkjay on Mar 01, '07 01:32:43PM

i just use HamachiX. Really simple, secure and works through firewalls / NAT traversal. Doesn't get much easier. I use it a lot with remote desktop to vnc onto other macs. Enjoy, Jay

[ Reply to This | # ]
Use Connect to Server to connect to anywhere
Authored by: xADudex on Sep 23, '12 05:42:21AM

I'm new to server and I'm currently setting up one. I'm setting up a 10.5.6 os x mac server and currently its up and running. The only problem is that when I try to connect to the server through its IP that I got from or any other IP tracker site it says that it can't connect just like the server din't exist. I have no idea of what I'm going to do. I've heard about Hamatchi but I can't use it since I need the ability to have screen shearing to start and stop programs that the server shall run.

[ Reply to This | # ]