Postgres says my password is invalid

Alex Clay aclay at mac.com
Sun Jan 30 18:37:26 UTC 2022


Hi Das,

The postgres user is an un-privileged user whose only job is to run the postgres server. The postgres user is not designed to be logged into under macOS, and you cannot run elevated commands as postgres (this is a good thing). This is why you got the following error:

> Dass-Mac-mini:~ postgres$ sudo nano /Library/PostgreSQL/14/data/postgresql.conf
> Password:
> postgres is not in the sudoers file.  This incident will be reported.

To work with a the postgresql.conf file, the process would be:

1. Log into your Mac using your normal user (you said this is server)
2. Open Terminal to get a shell
3. Run "sudo su - postgres" to switch to the postgres user
4. Run the command without sudo, i.e. "nano /Library/PostgreSQL/14/data/postgresql.conf"

The postgresql.conf file is owned by postgres and has limited access from other accounts (again, good for security). To recap, you can view this file by either:

1. Becoming the postgres user and view the file (no sudo needed)
2. Viewing the file as a user with elevated privileges (sudo required)

Prefer the first, if possible. In general, if you need to sudo, you better be doing something that needs it, like working with system services, installing software, or rebooting the machine (or having lunch: https://xkcd.com/149/).

Once you're in the file, follow Andy's suggestion for how to find the logging location. /var/log is standard on Linux (see https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard) but the EnterpriseDB installer for macOS may use a more macOS-friendly location.

Alex


> On Jan 30, 2022, at 13:01, Das Goravani <goravanis at gmail.com> wrote:
> 
> 
> On my server I have a user called “server” and Postgres installs a user called “PostgreSQL"
> 
> I’m talking main system users, what you log into when you first boot up a Mac.
> 
> I log into server always, I do everything from there.
> 
> I am doing this Postgres work from there.
> 
> This worked fine on the first installation of Postgres that I did a couple days ago. Being logged in as server was not a problem.
> 
> Today I tried to log into the PostgreSQL user, and had a myriad of problems.
> 
> First it said it didn’t have a keychain, and only option was to “Reset to defaults”. Being as I don’t know if the keychain is made on a per user basis, I did not opt to do this as I don’t want to lose everything in my server keychain.
> 
> Then when I cancelled on that window, I was supposedly “In the Finder”, but there was no menu bar, and things were stuck, could not click on the few things showing on the right side.. left side of menu bar, Apple etc., was missing.
> 
> Then did a keystroke to bring up the Force Quit list, and it said “Finder not responding”, so I relaunched it.
> 
> This did not help.. it continued to be missing the menu bar, could not do anything. 
> 
> Finally the menu bar appeared, tried to log out of that user, and the machine froze. Had to use the hard power switch to reboot the Mac Mini.
> 
> So my PostgreSQL user is messed up. It was created by the installer, and I have never logged into it til this attempt. 
> 
> I think I should delete it and reinstall Postgres. Let it create it again, and hope for better luck.
> 
> I was thinking of logging into that user and trying to run pgAdmin that way.. to see if anything was different, but I cannot effectively log into that user as it is. 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list