Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to reduce ssh connection time, by debugging sshd have found that libpam is loading all pam modules specified in /etc/pam.d/sshd file at every connection.

How to configure/modifiy libpam such that it loads modules only for first connection and after it uses same modules for every connection? I know libpam was designed for loading pam modules but want to load pam modules once.

Let me know if anyone have any idea.

I'm using OpenSSH_5.8p1, OpenSSL 1.0.0l and Linux-PAM-1.1.3

share|improve this question
Out of curiosity, did your debugging actually show that PAM loading was slow compared to the other parts of starting the session? If so, is PAM doing a lot of work to do authentication or is it really just the loading that is slow? Sorry to ask so many skeptical questions, it is just very surprising to me. I would expect other portions of the connection to dwarf simply loading the PAM modules. For example, if you have "UseDNS" set to yes. – Steven D Mar 27 '14 at 6:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.