简体   繁体   中英

Best Practice of running postgres in Ubuntu?

I just installed postgresql in Ubuntu 18.04 and been going through the official guide. Things I understand:

  • The installation comes with the default postgres user
  • We should not create databases with this default user
  • Instead we should create a different user

The questions I have are:

  • Why is this so?
  • Should the new user name I create be same as my ubuntu user $(whoami) ? Or should it be different ?
  • Should this new user be a superuser ?
  • When I have to delete or create databases/tables, do I have to log in to this newly created user or the default postgres user?

You should read the documentation, this is no substitute.

  • It is ok to use the user postgres to create databases.

  • Ideally there should be no remote connections with user postgres (block it in pg_hba.conf ).

  • Never let an application connect as superuser.

  • You should create other database users that are not superusers to create objects and work with them.

  • The name of the database users has no connection to the name of your operating system users.

  • For maximum safety, create objects with one user and let your application connect with a different user that has the required permissions on the objects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM