One in a while I need to check some data in a MS SQL Server in another location.
As for now this requires making database backup, moving it to another server so I can download the .bak file and recover on my local machine. But the database is growing so this is starting to be a pain.

Is it possible (and how?) to make a tunnel Win 7 -> Linux -> Windows Server 2008 with SQL Server for MS SQL Management Studio?
Linux and Windows Server are on the same network at the other location. Only the Linux server is visible externally.

Unfortunately I cannot make any changes on any machine.
I tried with SSH tunnel via Putty, but failed.

  • Can you connect from the linux machine to the sql server?
    Nov 6, 2012 at 11:12
  • At the moment probably no. There is no ODBC defined.
    – cichy
    Nov 6, 2012 at 11:39
  • From the linux machine type: telnet ip_of_win2008_machine 1433 and let me know what it says.
    Nov 6, 2012 at 11:44
  • ..:~$ telnet 1433 Trying Connected to Escape character is '^]'.
    – cichy
    Nov 6, 2012 at 12:12

4 Answers 4


On win7 machine, open putty and set the following settings for the linux ssh session: Connection->SSH->Tunnels->Source port: 1433, Destination:, select local radio button.

Now you should be able to connect to localhost:1433 from the win7 machine.

  • Almost working, im getting Error 10061 which is "Could not connect to TCP error code 10061: No connection could be made because the target machine actively refused it.". Will check this later. Thanks
    – cichy
    Nov 6, 2012 at 12:57
  • Would have been nice to hear why it wasn't working earlier and how it was fixed... Jul 27, 2013 at 12:00

Yes, it should be possible. Take a look here, for example. You would need to provide some more information if you need help setting up the tunnel.


Hmm if you can add new rule to iptables to linux server then you can accomplish this by simple port forwarding. But be aware that this is very dangerous because you will make your database visible from internet. Ofcourse you can enable port forwarding only when you need to connect to database server and use some none standard port. This is the rules that you must put in iptables on linux machine:


IPOFYOURNETWORK is ip of network or computer that you will try connect from

PORTNUMBER1 is port that you want your database to be visible for you (you can set up some none standard port)

IPOFDATASERVER:PORTNUMER2 it's ip and port of your database server.


Following the FINESEC's comment you could get the "connection actively refused" error.

I managed to solve it with checking the "Local ports accept connections from other hosts" and "Remote posrts do the same" checkboxes in Putty under Tunnels. In case someone finds this useful.

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.