I'm using WinSSHD on my server.

I can connect locally on the server via telnet&management studio, specificing the port 1433. I have allowed remote connections.

I can telnet from my local computer at localhost 14333(local port) and get the correct telnet prompt up.

But when I try to connect via management studio locally to localhost,14333 I get

TITLE: Connect to Server

Cannot connect to localhost,14333.


A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.) (Microsoft SQL Server, Error: 10061)

What a classic error message.

Is there any special reason this isn't working? Considering telnet is working via ssh, I thought I was home and dry.

  • If it were me, I would try to take the shenanigans out of it. Namely, you've got SSH sitting between you and the SQL process. See if you can connect with SSMS on 14333. That the error message says "the target machine actively refused it" is usually an indication to me that I have the wrong port. Also, what are you trying to accomplish with ssh? You can secure a connection with an SSL certificate installed on the server side. – Ben Thul Mar 26 '12 at 2:53

something else is at play here. I have successful got management studio to work over ssh, even with winsshd without issue.

Is SQL Server running as a default instance? May we see the port forwarding settings your using in your ssh/putty client?

| improve this answer | |

Although this isn't the real answer, I found that when I used http://www.bitvise.com/tunnelier It worked correctly.

I had to use ip, not hostname, but,14333 worked.

I'm guessing it's some kind of putty-> winsshd issue?

| improve this answer | |
  • SSMS (and other SQL Server clients?) require,<listening port> so this is likely the answer (assuming target is a SQL Server default instance). localhost,<listening port> does not map to per similar forum posts in SO. I'm investigating SSH tunneled connection to a SQL Server "named instance". For named instance I believe a different port is assigned, but looking for specifics before posting as candidate answer :-). docs.microsoft.com/en-us/sql/sql-server/install/… – Zephan Schroeder Feb 5 '19 at 5:31

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.