Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

postgres default user deleting

Greeting, When I install postgres it created default user with username/password = postgres. Lets say I want to deploy to use the database in production. I cant leave the default user like that ,because everyone would be able to log in to my database(people know about this default user).Of course I can restrict the ip from server,but I think its not a good idea.

What should I do. Should I DELETE DEFAULT USER? Should I leave default user,but CHANGE THE PASSWORD?

like image 835
sparrow_21 Avatar asked Sep 13 '25 09:09

sparrow_21


1 Answers

Good options are:

  • Change or clear the password.

  • Disable logins as postgres:

    ALTER ROLE postgres NOLOGIN;
    

    That second option requires that you either have another superuser or that there is a role that can become postgres with SET ROLE:

    CREATE ROLE admin LOGIN NOINHERIT IN GROUP postgres;
    
like image 138
Laurenz Albe Avatar answered Sep 14 '25 23:09

Laurenz Albe