pgcli icon indicating copy to clipboard operation
pgcli copied to clipboard

SSH tunneling with a SSH key

Open warcayac opened this issue 3 years ago • 1 comments

I've installed these packages:

$ pip install --upgrade pgcli
$ pip install sshtunnel

I'm trying to run:

$ pgcli postgresql://someone:secret1@localhost:4567/mydb --ssh-tunnel anyone:[email protected]:789

I get this output:

Could not establish session to SSH gateway

Indeed I use a custom SSH key: ~/.ssh/chesu_rsa

so I tried with:

$ pgcli postgresql://someone:secret1@localhost:4567/mydb --ssh-tunnel anyone:[email protected]:789 -i ~/.ssh/cype_rsa

or

$ pgcli postgresql://someone:secret1@localhost:4567/mydb --ssh-tunnel anyone:[email protected]:789 -K ~/.ssh/cype_rsa

I get these error messages respectively:

Error: No such option: -i
Error: No such option: -K

How do I resolve this problem?

PS: I'm using latest version of pgcli and sshtunnel.

warcayac avatar Apr 05 '22 19:04 warcayac

Make sure you don't use ProxyJump in ~/.ssh/config for the tunnel host. I have the same error and replacing ProxyJump with ProxyCommand ssh -W %h:%p fixed it.

favadi avatar Oct 21 '22 13:10 favadi