I can't seem to figure out how to connect to AFP over SSH. Here is my setup:

[Raspberry Pi] <---> [router] <---> (Internet) <---> [Client]

I'd like to be able to connect to my home's WAN IP address on port 5123 to access the AFP server running on my Raspberry Pi over SSH.

I've already:

  1. Installed AFP and SSH servers on my Raspberry Pi
  2. Configured SSH on my Pi to work over port 5123
  3. Forwarded port 5123 of my router's WAN to my Raspberry Pi

And yes, I've tried googling for instructions but I couldn't get it to work.


Don't forward to AFP-Port on Pi. For Security Reasons. That's probably the reason why you want to use a ssh-tunnel.

  1. Forward from [Router] to SSH-Port on [Raspberry Pi]

  2. On your [Client] you should now setup the port forward:
    ssh -p PORT -Nf raspberry-user@WAN-IP -L 5123:localhost:5123
    (switch "-N" is for not executing remote-commands, "-f" forks to background)
    The "PORT" is the external port from your [Router], which is forwarded to [Raspberry Pi]

  3. Connect AFP on [Client] to localhost:5123

  • cl.ly/image/142V1M1O3X1z :(
    – Alexander
    Feb 14 '13 at 3:46
  • Please paste ssh-command, afp-connect (command or gui-screenshot). maybe also do a lsof -i | egrep ^afpd on the [Raspberry Pi] and paste that output too.
    – xx4h
    Feb 14 '13 at 5:25
  • I can only test the connection through LAN for now, so that's the IP i used: "$sudo -p 5123 -Nf pi@ -L 5123:localhost:5123" and accessed via "afp://localhost:5123" from my web browser (which sends off the command to Finder to handle)
    – Alexander
    Feb 14 '13 at 6:46
  • first of all, you can not use same port for ssh and afp. the -p switch from ssh-command is for the ssh server port (default is 22, if you didn't changed this, you don't need -p, but you can -p 22. i think it should work for you with: ssh -Nf pi@ -L 5123:localhost:5123 and then access via browser.
    – xx4h
    Feb 14 '13 at 6:53
  • I'd need the "-p 5123" because i've configured that as my SSH port, so should i tunnel a different port? (for example, 5124)
    – Alexander
    Feb 15 '13 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.