2

I made this file: /etc/sudoers.d/myfile

myuser ALL=(postgres) ALL

I rebooted the system and then I tried:

su - postgres

I entered MY password but it failed with su: Authentication failure, am I missing something?

EDIT: there are just another sudoers.d file that is the system standard /etc/sudoers.d/90-cloud-init-users with this content root ALL=(ALL) NOPASSWD:ALL.

4
  • Sorry, "-" was a typo. The file is the only custom one, the other is the system file 90-cloud-init-users loaded after myfile with this content root ALL=(ALL) NOPASSWD:ALL Commented yesterday
  • 1
    How about "sudo su postgres"? Commented yesterday
  • Please try sudo -i -u postgres. Commented yesterday
  • 1
    Sorry, "-" was a typo. then please fix it using edit ? Commented 23 hours ago

1 Answer 1

6

The setup using sudoers.d grants sudo access to run commands as the postgres user, but you used the su command which works differently.

Since you entered "MY password" (the password for myuser) when prompted by the su command, the authentication failed because su expects the password for the postgres user. The sudoers file is irrelevant to the su command's password requirement.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.