From d8ab4e638b83ef9446024b3498e7431becde233e Mon Sep 17 00:00:00 2001 From: Henrik Xavier Nepstad Date: Fri, 9 Oct 2026 13:29:49 +0200 Subject: [PATCH] Docs: Updated docs with how to change the credentials of the postgres user --- docs/postgresql-setup.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/postgresql-setup.md b/docs/postgresql-setup.md index 9a236b8..672f01d 100644 --- a/docs/postgresql-setup.md +++ b/docs/postgresql-setup.md @@ -53,3 +53,22 @@ postgres=# SELECT version(); PostgreSQL 18.6 (Ubuntu 18.6-0ubuntu0.26.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 15.2.0-16ubuntu1) 15.2.0, 64-bit ``` +## Changing Postgres user password + +Since `PostgreSQL` runs under the `postgres` user, we need to use that user to access the database. By default, this user has no password, but by running the following command, we add a password. + +```txt +user@it2810-11:~$ sudo passwd postgres +[sudo: authenticate] Password: +Enter new password: +Retype new password: +Retype new password: +passwd: password updated successfully +user@it2810-11:~$ +``` + +Setting the password on the postgres instance itself is done with the following command + +```txt +sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'super-secret-password-that-you-cant-read';" +```