The peer authentication method works by obtaining the client's operating system user name from the kernel and using it as the allowed database user name (with optional user name mapping). This method is only supported on local connections.
Please check the below steps as an Example:
1>> Create user edb_admin.
useradd edb_admin
2>> Create database user edb_admin or if already exist then make sure that the password of database user and os level user must match.
createuser -sP edb_admin
3>> If os level user is not exist with same password then it will show error like as follows:
[root@localhost pg_log]# /opt/PostgreSQL/9.3/bin/psql -U edb_admin -d edb -p 5444
psql.bin: FATAL: Peer authentication failed for user edb_admin"
[root@localhost pg_log]#
Once you will create user with password then login to the os level user nocp_admin and try to connect by same command:
[edb_admin@localhost pg_log]$ /opt/PostgreSQL/9.3/bin/psql -U edb_admin -d edb -p 5444
psql.bin (9.3.1.3)
Type "help" for help.
edb=> \q
[edb_admin@localhost pg_log]$
Hope this helps.