

NET applications on a Windows virtual machine within a Linux or MacOS host, you don't need PuTTY, because you have an easier option. Keep the PuTTY window open, though you can minimize it and you don't need to type anything into it. Reminder: If you disconnect your PuTTY session, you will lose your database connection. As long as the PuTTY SSH connection is open, all traffic to localhost:1433 will be tunneled through the SSH connection and forwarded to the remote database server. We're using 127.0.0.1 here, even if we don't have a database server installed on the local machine. Set your connection strings to point to the host "127.0.0.1" or "localhost".įor a typical ASP.NET project, we would edit the Web.config file and change the connection strings like this: NET projects have the connection strings stored in Web.config or App.config, but your application may vary.

Now it's time to edit your application's configuration files. Leave your SSH session open for the remaining steps. Save your session again, then it should be ready to test.
#PUTTY AS SSH PROXY PC#
Remote PC (Windows) -> Gateway server (linux) -> Database Server (Windows) The basic network diagram would look like this: What we want to do here is forward traffic on the SQL Server port (1433) on to a different machine. PuTTY has some very powerful port forwarding options, though they can be a bit confusing. Once that's working, it's time to set up the port forwarding. If you have trouble, your company's network engineer should be able to help. Now, save your session and try connecting to it, just to make sure the SSH connection works.
#PUTTY AS SSH PROXY PASSWORD#
If you're using a password to connect, you can skip the last step.

It's also helpful to use Pageant to manage your keys. If you are using an SSH key (recommended), you can set it up in the Connection -> SSH -> Auth tab on the PuTTY configuration window. It's the address of the server you can connect to with SSH, not the address of the SQL server. This should be the domain name or a public IP address. Start PuTTY and enter the hostname and port of your gateway server. The instructions below will work equally well whether you use a password or a key to log into the gateway server. If you're new to PuTTY, try the official documentation ( ) and a guide to creating SSH keys at This is not meant to be a "getting started" guide for using PuTTY. This article assumes you already have a basic familiarity with SSH concepts and use of PuTTY to open SSH connections from Windows. With the proper port forwarding setup, you can connect to your database from anywhere. This will serve as a gateway or makeshift proxy server. All you need is a server in the office which accepts SSH connections and can connect to the SQL Server. There is another way to connect, using PuTTY and port forwarding. But, what if the database is in your office, and you want to access it remotely, but you don't have a VPN? Connecting to a Microsoft SQL Server database isn't too hard, most of the time.
