HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlCritical

Superuser is not permitted to login

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
superuserloginpermittednot

Problem

I created a superuser portal with the following command

create role portal with superuser password 'portal'


When I tried to login into postgres with portal user I am getting the following error in rails.

FATAL:  role "portal" is not permitted to log in


I can't follow what is going on.

of course I can alter user with login command to enable portal user to login. I would like to understand why super user can't login.

Solution

You didn't specify the LOGIN right:

ALTER ROLE portal WITH LOGIN;


If you use CREATE USER instead of CREATE ROLE the LOGIN right is granted automatically; otherwise you must specify it in the WITH clause of the CREATE statement.

Superusers do not inherently have the LOGIN right; a permissions check is still performed for superuser for this right. The reason for this is so that you can have a superuser role that you can SET ROLE to, but cannot be connected as directly.

Code Snippets

ALTER ROLE portal WITH LOGIN;

Context

StackExchange Database Administrators Q#57723, answer score: 61

Revisions (0)

No revisions yet.