0

Got permission denied when switching user from root to postgres. No issue switching from root to ubuntu.

root@node-01:~# su - postgres
su: Permission denied
(Ignored)
postgres@node-01:~$ logout
root@node-01:~# su - ubuntu
ubuntu@nodeg-01:~$

Here is the /etc/passwd and /etc/group entries:

postgres:x:998:998::/home/postgres:/bin/bash

postgres:x:998:

  • 1
    Does the postgres user have an "su" in its shell init files? – Jeff Schaller Mar 2 at 17:07
  • There's no shell init files for postgres user. – CJ Chang Mar 2 at 17:18
  • What happens if you remove the login option shortcut (-)? – garethTheRed Mar 2 at 17:21
  • same error without (-) – CJ Chang Mar 2 at 17:22
  • Possibly PAM is interfering? – Peschke Mar 2 at 17:51
0

Problem solved by adding the user to /etc/security/access.conf.

-3

While logged in as the root user type:

"chmod 775 /bin/su"

This changes the permissions for owner and groups to 7 (r,w,x) and the permissions of other users to 5 (r,x) of the 'su' binary file in the /bin directory.

  • tell me if this works or not – Qasim Mar 2 at 21:51
  • same error -rwxrwxr-x 1 root root 40128 May 16 2017 su – CJ Chang Mar 2 at 22:36
  • 2
    Do not do this. That breaks su on most systems. su is normally owned by root:root and permission 4755 – Stephen Harris Mar 3 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.