PostgreSQL DB with pgAdmin4 access through SSH tunnel

Despite using console most of the time I have a preference to edit PostgreSQL databases through UI. Especially when it comes to remote side. Usually one can access this through $ psql command. However this tends to writing raw SQL queries and a lot of typing in overall.
Here is a way to do it with UI. First one needs to make a tunnel.Command is fairly simple:
ssh -fNg -L 5555:localhost:5432 {username}@{host.com}
One has a tunnel afterwards. This command opens a SSH connection in the background mapping your local port 5555 to your server’s port 5432 (Postgres’ default port). To understand one can observe the meaning of the flags via $ man ssh to see what each of these flags doing.
 It can be accessed via localhost tools like pgAdmin4 at localhost and port 5555
DB config would look like so:

Comments

Popular posts from this blog

Django: Resetting Passwords (with internal tools)

Time Capsule for $25

Vagrant error: * Unknown configuration section 'hostmanager'.