This project is read-only.

Accessing psql after login to a server

Dec 8, 2014 at 6:41 PM
I was able to successfully connect to a server using SSH in C#.
the server has Postgres client listed as one of its applications.
The problem is, if I enter the command "psql" in putty, it would take me to the interactive client.
however, if I try to do it in code,
runCommand("psql"); and write the result to console.
nothing happens.

Any help would be appreciated.
Dec 8, 2014 at 9:09 PM
Did you used the property SshCommand.Result? This will block till the execution is finish.
If you run a command that expects input you have to use SshCommand.OutputStream to get the data.
Unfortunally there is no way to send data, yet. We are currently working on that problem.
A quick solution for that problem is here:

You can use SshClient.CreateShell or SshClient.CreateShellStream. In this way you can send data without modifying the code.
Creating a shell is the same putty does on connect.
Dec 9, 2014 at 8:52 AM
Instead of doing the shell dance, I propose to use a local forwarding.
You can forward the database socket to your ssh client and talk to the database directly.