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.: