Red Hat Bugzilla – Bug 242237
Please change postgresql init scripts so that postgres can have /sbin/nologin as a shell
Last modified: 2015-02-13 15:50:25 EST
Description of problem:
Changing postgres' shell to /sbin/nologin as an extra security backstop breaks
the postgresql init scrip because it uses the -l option to su/runuser.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. chsh -s /sbin/nologin postgres
2. service postgresql restart
The command fails.
The command succeeds.
There doesn't seem to be a good reason to do this. I looked at the scripts and
the passed pathnames appeared to be absolute. If the locales are set differently
in postgres' dotfiles than root's or the invocers then this will affect initdb.
But I am not sure that the current behavior is any more expected, then using
root's locale and in the normal case they'll be the same.
Well, in the first place I disagree with not allowing someone to su to postgres --- that's a useful thing to
do for maintenance/diagnostic purposes. In the second place, we can't just remove the -l option because
that installs possibly-important environment settings for the postmaster. Accordingly, this is not a bug in
You are correct. I could have sworn that having /sbin/nologin only blocked su -l,
no su without the -l. But after testing it to verify what you said, I withdraw
my request. Sorry about bugging you about this one.