I am trying to forward port 139 from a Windows machine to my Ubuntu SSH server on a tun interface with the ip address

This is so that I can access the windows shares on the machine on my Ubuntu server, through the reverse tunnel.

I can forward ports to, but not to

On windows I am using the Tunnelier ssh client.

On my Ubuntu server, the following message is printed in auth.log:

Received disconnect from 11: Server denied request for client-side server-2-client forwarding on

So far i have tried the following settings:

GatewayPorts yes
PermitTunnel yes
AllowTcpForwarding yes 

in the /etc/ssh/sshd_config file, but it did not work.

I set up the tun like this:

sudo tunctl -t loc_0 -u myusername
sudo ifconfig loc_0 inet netmask up

The settings in the Tunneler ssh client should not matter because I can forward port 139 successfully to the Microsoft Loopback Adapter on a Windows machine running the WinSSHD server.

Versions: Windows is XP SP3, Ubuntu is 10.10.


I tried to forward the port to a number greater than 1024 mentioning the IP address of the tun, and it successfully connected but the forwarding was done on instead of the tun's IP address

So there are two separate problems now, when connecting from the Windows machine:

1) Forwarding on ports less than 1024 is probably being denied. How can we allow that on the server?

2) Forwarding is done only on even if I mention which is the tun's IP address.

Another attempt: I also tried to forward port 22 of a Linux machine to the tun's port 55567. It showed success. But when I tried to ssh into that port using both local addresses, on the Linux machine in its debug display I got the error Connection failed: no route to host when using to connect and simply Connection refused when using the tun's IP address.

So the tun is not getting the forwarded port no matter we connect from a Windows client or a Linux client.

  • Which version of Windows you have? They made bad changes after XP if I remember correctly. – Eduardo Ivanec Apr 16 '11 at 0:42
  • @Eduardo: I've mentioned the versions of the OS's. Do you have any idea about configuring a tun device for such a purpose, because I can forward the port successfully onto an ssh server running on Windows. – sarshad Apr 16 '11 at 19:14
  • SSH tunnels and tun interfaces have nothing to do with each other. – Chris S Apr 16 '11 at 19:16
  • @Chris S: I want to forward the port to the tun's IP address, instead of How can I do that? Or is it just not possible on Linux? – sarshad Apr 16 '11 at 19:19
  • I understand now. My apologies. Try AllowTcpForwarding yes – Chris S Apr 16 '11 at 19:23

Regarding <1024 you can only do that by using root for the ssh tunnel:



Setting up port forwarding to listen on ports below 1024 requires root level access.

Regarding you probably need to use '-g' in your ssh setup:

 -g      Allows remote hosts to connect to local forwarded ports.

What´s about this:

sudo ifconfig eth0:0 up
sudo ssh -g -L 139: user@sambahost

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.