I'm trying to create a new user in PostgreSQL installed on Ubuntu 20.04:
$ sudo -u postgres createuser --superuser tommy
But when I try to create a database with that user it says unknown user:
$ sudo -u tommy createdb tommy_db
sudo: unknown user: tommy
sudo: unable to initialize policy plugin
The think is that I already know that there are UNIX users and PostgreSQL users and I don't know if I have to create first a UNIX user tommy or not.
I would like to take advantage of the post and ask what is the difference between a postgreSQL user and a UNIX user in postgreSQL in terms of database management.
PD: If I list the users using /du in plsql I can see the created user tommy:
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
tommy | Superuser, Create role, Create DB | {}
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
create role tommy login password 'xyz' superuserroot