su, postgres, and pam [SOLVED]

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
User avatar
Pasketti
Tux's lil' helper
Tux's lil' helper
Posts: 109
Joined: Thu Sep 04, 2003 12:47 am
Location: Austin, Texas

su, postgres, and pam [SOLVED]

Post by Pasketti »

On my last emerge -u, both postgresql and pam got updated. No biggie.

But now when I try to start or stop postgresql, I get this:
su: Authentication service cannot retrieve authentication info.

The postgresql script in /etc/init.d has a few lines in it like this:
su - $PGUSER -c "/usr/bin/pg_ctl start -D '$PGDATA' -s -l '$PGLOG' -o '

which I think is where the problem lies. That script didn't change in the upgrade - I checked the dispatch-conf archive to be sure - so it has to be something in pam. I'm thinking that during the pam upgrade, something in one of the pam files got changed to where it isn't working like it used to.

Unfortunately, my pam-fu is weak. I pity me.

I checked the config files in /etc/pam.d, but nothing stands out other than the removal of the library paths.

I can su to root just fine.

Any ideas?

new /etc/pam.d/su:

Code: Select all

auth       sufficient   pam_rootok.so
auth       required     pam_wheel.so use_uid
auth       include              system-auth
account    include              system-auth
password   include              system-auth
session    include              system-auth
session    required     pam_env.so
session    optional             pam_xauth.so
new /etc/pam.d/system-auth:

Code: Select all

auth       required     pam_env.so
auth       sufficient   pam_unix.so likeauth nullok
auth       required     pam_deny.so
account    required     pam_unix.so
password   required     pam_cracklib.so retry=3
password   sufficient   pam_unix.so nullok md5 shadow use_authtok
password   required     pam_deny.so
session    required     pam_limits.so
session    required     pam_unix.so
old /etc/pam.d/su:

Code: Select all

auth       sufficient   /lib/security/pam_rootok.so
auth       required     /lib/security/pam_wheel.so use_uid
auth       required     /lib/security/pam_stack.so service=system-auth
account    required     /lib/security/pam_stack.so service=system-auth
password   required     /lib/security/pam_stack.so service=system-auth
session    required     /lib/security/pam_stack.so service=system-auth
session    required     /lib/security/pam_env.so
session    optional     /lib/security/pam_xauth.so
old /etc/pam.d/system-auth:

Code: Select all

auth       required     /lib/security/pam_env.so
auth       sufficient   /lib/security/pam_unix.so likeauth nullok
auth       required     /lib/security/pam_deny.so
account    required     /lib/security/pam_unix.so
password   required     /lib/security/pam_cracklib.so retry=3
password   sufficient   /lib/security/pam_unix.so nullok md5 shadow use_authtok
password   required     /lib/security/pam_deny.so
session    required     /lib/security/pam_limits.so
session    required     /lib/security/pam_unix.so
Last edited by Pasketti on Sat Jul 09, 2005 6:37 pm, edited 1 time in total.
User avatar
Pasketti
Tux's lil' helper
Tux's lil' helper
Posts: 109
Joined: Thu Sep 04, 2003 12:47 am
Location: Austin, Texas

Post by Pasketti »

The problem turned out to be a missing entry for user "postgres" in /etc/shadow.

I added a passwordless entry for user postgres, and the error went away.
User avatar
Pasketti
Tux's lil' helper
Tux's lil' helper
Posts: 109
Joined: Thu Sep 04, 2003 12:47 am
Location: Austin, Texas

Post by Pasketti »

I just remembered that shadow also got updated.

No idea if that caused the problem or not, but I ran pwconv to recreate /etc/shadow just in case entries were needed for the other service accounts.
User avatar
shugaa
Tux's lil' helper
Tux's lil' helper
Posts: 87
Joined: Fri Apr 18, 2003 9:34 am

Post by shugaa »

Thanks for sharing. Had the same problem and your advice solved it for me, too.
User avatar
lkraav
Tux's lil' helper
Tux's lil' helper
Posts: 130
Joined: Wed Oct 13, 2004 9:43 pm
Location: Estonia

Post by lkraav »

you guys rock, it worked.
User avatar
NightMonkey
Guru
Guru
Posts: 360
Joined: Fri Mar 21, 2003 10:07 am
Location: Philadelphia, PA

Post by NightMonkey »

Pasketti wrote:The problem turned out to be a missing entry for user "postgres" in /etc/shadow.

I added a passwordless entry for user postgres, and the error went away.
This is really strange. It appears that on two of my boxes, /etc/shadow (timestamp Jun 9 11:21 PDT on one, and Jul 5 14:30 PDT on another) got severely truncated. Many users, especially daemon users, got zapped, like cron, apache, etc. Genlop doesn't report anything merging at that exact time, but the shadow package had been updatedand I haven't modified that file myself in many months.

Really odd. The solution here (pwconv) appears to have fixed the problem, but it is worrysome to have this file just get "wonky" all of a sudden. :( Anyone have similar behavior?
User avatar
converter
Apprentice
Apprentice
Posts: 163
Joined: Tue Dec 24, 2002 11:19 pm

Post by converter »

NightMonkey wrote:
Pasketti wrote:The problem turned out to be a missing entry for user "postgres" in /etc/shadow.

I added a passwordless entry for user postgres, and the error went away.
This is really strange. It appears that on two of my boxes, /etc/shadow (timestamp Jun 9 11:21 PDT on one, and Jul 5 14:30 PDT on another) got severely truncated. Many users, especially daemon users, got zapped, like cron, apache, etc. Genlop doesn't report anything merging at that exact time, but the shadow package had been updatedand I haven't modified that file myself in many months.

Really odd. The solution here (pwconv) appears to have fixed the problem, but it is worrysome to have this file just get "wonky" all of a sudden. :( Anyone have similar behavior?
Thanks to this particular postgres issue, I just noticed that my shadow file hadn't been updated in a long while, so it's probably an issue with the shadow package. I'd bet that there was a nice little "you must do this after updating shadow" message after an upgrade a while back and we both missed it.
converter
User avatar
sirber
n00b
n00b
Posts: 37
Joined: Wed Apr 07, 2004 1:10 pm

Post by sirber »

worked for me! thanks! :D
User avatar
funeagle
Tux's lil' helper
Tux's lil' helper
Posts: 102
Joined: Tue Aug 05, 2003 12:41 pm
Location: London

Post by funeagle »

Worked for me too ! thanx!
allan
n00b
n00b
Posts: 49
Joined: Mon Feb 24, 2003 8:40 pm
Location: Ann Arbor,Michigan

Post by allan »

Thanks for the hint about /etc/shadow being out of sync. Both apache and postgresql startups were complaining for me.

BTW - The program 'pwconv' will resync /etc/shadow for you. No need to edit by hand. :D
kiksen
Guru
Guru
Posts: 401
Joined: Mon Jun 24, 2002 5:11 pm
Location: Denmark

Post by kiksen »

Thanks... pwconv did the trick.
Post Reply