Tunneling AFP over SSH

| | Comments (1) | TrackBacks (0)
Here's a neat OpenSSH trick for accessing an AFP fileshare remotely (and securely).

In Mac OS X, open a terminal window and type:

$ ssh -l [username] [servername] -L 10548:127.0.0.1:548 sleep 3000

Replace [username] and [servername] with your username on the server that you are trying to connect to. The -L parameter controls port bindings. What we are doing with these options is binding the remote AFP server (the remote port 548) to port 10548 on server 127.0.0.1 (the localhost), with all communication happening over SSH (port 22). 
This command will prompt you for a password. Enter your password for the remote host.

This will how seem to hang, but what it is actually doing is keeping the SSH active. Don't close the terminal window, as that would terminate the tunnel. You can minimize or hide it safely, however. Now, connect to the remote server with the following address:

afp://127.0.0.1:10548


This connects AFP to the port on your local machine that you bound to the remote server over ssh. From here on out, you can treat it like a perfectly normal AFP share -- it will prompt you for a username and password just as it usually would without the SSH tunnel.

0 TrackBacks

Listed below are links to blogs that reference this entry: Tunneling AFP over SSH.

TrackBack URL for this entry: http://snackfin.com/mt/mt-tb.cgi/6

1 Comments

Instead of using sleep 3000, simply pass the -N option to ssh. This will forward the port, but execute no commands on the remote server.

Leave a comment

Tag Cloud

Powered by Movable Type 4.12