Server Fault is a question and answer site for system and network administrators. 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

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.

share|improve this question
Can you connect from the linux machine to the sql server? – FINESEC Nov 6 '12 at 11:12
At the moment probably no. There is no ODBC defined. – cichy Nov 6 '12 at 11:39
From the linux machine type: telnet ip_of_win2008_machine 1433 and let me know what it says. – FINESEC Nov 6 '12 at 11:44
..:~$ telnet 1433 Trying Connected to Escape character is '^]'. – cichy Nov 6 '12 at 12:12
up vote 3 down vote accepted

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.

share|improve this answer
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 '12 at 12:57
And it's working! Thank you very much! :) – cichy Nov 6 '12 at 12:58
Would have been nice to hear why it wasn't working earlier and how it was fixed... – Tomislav Nakic-Alfirevic Jul 27 '13 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.

share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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.