Login using postgres user

$ ssh -l postgres
[email protected]'s password: 
Linux localhost 4.9.0-9-amd64  #1 SMP Debian 4.9.168-1 (2019-04-12) x86_64

// Login as PostgreSQL superuser “postgres” on remote PostgreSQL server using ssh (Linux)

root@localhost:~# su - postgres

// Login as PostgreSQL superuser “postgres” (Linux)

Enter postgres terminal

postgres@localhost:~$ psql
psql (9.6.12)Type "help" for help.postgres=#

// Enter PostgreSQL Command Line via “psql” client (psql)

Connect database

\c test

You are now connected to database "test" as user "postgres".

// Connect to a PostgreSQL database “test” as “postgres” user (psql)

Check psql client version

$ psql -V
psql (PostgreSQL) 9.6.12

// Check psql client version (psql)

Check Postgres server version

select version();
 PostgreSQL 9.6.12 on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit
(1 row)

// Check Postgres server version (SQL)