Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Ubuntu as desktop and server OS. When I am logged in to the server via SSH on the terminal to change the smb/afp configuration, I can only test the configuration from the server over terminal.

Is there a way to tunnel the connection over SSH (no VPN, only one SSH port is open on the firewall) so that I also could test the connection from my Ubuntu or OS X desktop host?

share|improve this question
up vote 1 down vote accepted

You can use ssh to tunnel any port under SSH.

sudo ssh -L 139:localhost:139 user@server

Now if you try to connect to the 139 port in your computer you will be connecting to 139 in the server. Notes:

  • You need to use sudo to open a priviledged port(<1024) on your computer, not nice.
  • It won't work if you're already using port 139 (i.e. you are running samba on the local computer)
  • You will need to use your local computer by IP (we are not tunneling nbm).

Not nice at all, but it's the best idea that I have.

share|improve this answer
OS x does not allow to connect to the localhost over afp/smb I'll try Ubuntu later – Reivax Jan 31 '11 at 10:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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