Difference between revisions of "Ssh tunnel"

From wikieduonline
Jump to navigation Jump to search
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{lc}}
 
{{lc}}
 
+
TOMERGE: [[Reverse SSH tunneling]]
  
 
https://stackoverflow.com/questions/16835761/postgresql-via-ssh-tunnel
 
https://stackoverflow.com/questions/16835761/postgresql-via-ssh-tunnel
  
 
Run on your [[jump server]] or [[bastion]] host:
 
Run on your [[jump server]] or [[bastion]] host:
[[ssh -L]] 1111:localhost:5432 user@remote.example.com
+
* <code>[[ssh -L]] 1111:localhost:5432 user@your-jump-server.com</code>
[[psql -h]] localhost -p 1111 -U your-db-username database-name
 
  
 +
Connecto to the tunnel:
 +
* <code>[[psql -h]] localhost -p 1111 -U your-db-username database-name</code>
  
[[ssh -N]] -f [[-L]] 1111:localhost:5432 [email protected]
 
  
 +
[[ssh -N]] [[-f]] [[ssh -L|-L]] 1111:localhost:5432 [email protected]
  
  
 +
== Errors ==
 
  2023-02-03 17:06:31.995 UTC [36921] postgres@postgres DETAIL:  User "[[postgres]]" [[has no password assigned]]
 
  2023-02-03 17:06:31.995 UTC [36921] postgres@postgres DETAIL:  User "[[postgres]]" [[has no password assigned]]
 +
[[kex_exchange_identification: Connection closed by remote host]]
  
 
== Related ==
 
== Related ==
 
* <code>[[ssh -L]]</code>
 
* <code>[[ssh -L]]</code>
 +
* <code>[[ssh -R]]</code>
 +
* <code>[[ssh -p]]</code>
 
* <code>[[~/.pg_service.conf]]</code>
 
* <code>[[~/.pg_service.conf]]</code>
 +
* [[Reverse SSH tunneling]]
  
 
== See also ==
 
== See also ==

Latest revision as of 12:43, 25 January 2024

Advertising: