On ubuntu 14.04, I had a problem with my user authenticating on a domain of my company over ldap, and the IT guy played about with some configuration files and packages. Now, on a local user, whenever I execute a command with sudo the prompt asks twice for a password.

I've been searching quite extensively through the Internet, and cannot find the solution. I've tried every possible solution: all the PAM configuration files have been reset, as well as /etc/nsswitch.conf. I have uninstalled and purged all the packages related to ldap, have checked /etc/hostsand /etc/sudoers... but the problem remains.

The only two significant clues that I can provide is that this only happens on the command line (if I execute synaptic from with the GUI, the system only asks me for the password once), and it seems, from /var/log/auth.log, that pam_unix.so is being invoked only once, so PAM seems to be ok.

How can I trace the origin of this problem?


I've managed to solve my problem. What was confusing me is that I thought that

pam-auth-update --force

was overwriting completely all the PAM configuration files (/etc/pam.d/common-*), so that those files would end up as if they were brand new. But it does not. What pam-auth-updatedoes is to overwrite all the text of those files up to the last line of the default configuration file, which actually reads # end of pam-auth-update config (I had failed to realise that it was quite self-explanatory). Anything written by the user before that line is overwritten, but everything that appears after that line is not touched by the update.

For some reason the lines

@include common-auth
@include common-session
@include common-session-noninteractive

that are called by PAM when executing the service sudo, had been pasted at the very end of the common-session-noninteractive file, and updating PAM was not deleting them. They were making PAM ask for the password a second time.

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.