4

I set my password to ir****3 when installing Ubuntu, but when I try to use su - postgres on terminal and enter tge same password it shows authentication error: you are not a root user.

How can I fix this?

Zanna
  • 72,312

1 Answers1

7

In order to run

su - postgres 

you have to be root as the output says

=> If you are not root you have to run it with sudo like

sudo su - postgres

Or alternatively become root first using

sudo -i

su - postgres

Anyway both methods will only work, if your actual user is in the sudo group. You can check that listing all groups your user is in by running

groups

If it is not in the sudo group than you probably are not the one who installed this machine or have added this user afterwards.

By default the first added user during the installation is in the sudo group.

If this is the case you have to login as a user which is in the sudo group (or if this is not possible you can boot into a root terminal following this answer)

and add your user manually to the sudo group running

sudo adduser <username> sudo
dessert
  • 40,956
derHugo
  • 3,376
  • 5
  • 34
  • 52