2

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:

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

2 Answers 2

1

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

1
  • This did not solve my issue. Is there a service you need to restart after changing this? Commented Dec 2, 2021 at 15:26
-6

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .