'Default Roles Cannot Login Postgres 10

I am configuring a postgres database and I see that the default roles, pg_monitor, pg_read_all_settings, pg_read_all_stats, pg_signal_backend, and pg_stat_scan_tables all cannot login. I'm not sure what the first step would be. Here is the output of \l and \du:

postgres=# \l
                                   List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |    Access privileges
-----------+----------+----------+-------------+-------------+-------------------------
 confdb02  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres           +
           |          |          |             |             | postgres=CTc/postgres  +
           |          |          |             |             | confluence=CTc/postgres
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres            +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres            +
           |          |          |             |             | postgres=CTc/postgres
(4 rows)

postgres=# \du
                                                            List of roles
      Role name       |                   Attributes                   |                          Member of
----------------------+------------------------------------------------+--------------------------------------------------------------
 confluence           | Superuser, Create role, Create DB              | {}
 pg_monitor           | Cannot login                                   | {pg_read_all_settings,pg_read_all_stats,pg_stat_scan_tables}
 pg_read_all_settings | Cannot login                                   | {}
 pg_read_all_stats    | Cannot login                                   | {}
 pg_signal_backend    | Cannot login                                   | {}
 pg_stat_scan_tables  | Cannot login                                   | {}
 postgres             | Superuser, Create role, Create DB, Replication | {}

Thanks!


Solution 1:[1]

add the attribute LOGIN to the role, with this command:

ALTER ROLE username LOGIN;

Don't forget the user needs a password:

ALTER ROLE username WITH PASSWORD 'user_secret_password';

You will also need to give permission over the Database, like:

GRANT SELECT ON DATABASE databasename TO username;

The list of permissions are these:

SELECT
INSERT
UPDATE
DELETE
TRUNCATE
REFERENCES
TRIGGER
CREATE
TEMPORARY or TEMP
EXECUTE
USAGE
ALL PRIVILEGES

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gustavo Gonçalves