When I try to change user (starting as postgres user) using the command
sudo -i -u ubuntu
The password for postgres is prompted. Now the postgres account was created upon installing postgres, and I don't know what the password is. I have tried changing the password in the psql prompt with
ALTER USER postgres PASSWORD 'password'; ALTER ROLE postgres PASSWORD 'password'; ALTER USER postgres WITH PASSWORD 'password'; ALTER ROLE postgres WITH PASSWORD 'password'; \password ;
These have enabled me to set the password for the database server login, but not for the linux user, which makes sense I guess. And trying it with the passwd command doesn't work because it asks for the old password first. I have added postgres to the /etc/sudoers file as well.