Managing PostgreSQL Process on Ubuntu - service, pg_ctl and pg_ctlcluster

If you've ever dealt a bit more seriously with PostgreSQL, and gone through different online articles and examples, chances are that you've ran to pg_ctl command. Being Ubuntu user, I've often wondered what is the difference between starting PostgreSQL by using Ubuntu-native service command and pg_ctl. After some research I've found out what is the catch, and here I'll share this with you.

Passwordless SSH in Linux

In some cases you'll want to be able to SSH another server, without being prompted for password. For example, when dealing with PostgreSQL replication you'll need to execute a command on another server as postgres user:

$ ssh -T postgres@OTHERHOST /etc/postgresql/9.5/main/replscripts/disable_postgresql.sh

In such cases you'll want to avoid password prompt for many reasons, i.e.: