pam_unix − Module for traditional password authentication



This is the standard Unix authentication module. It uses standard calls from the system´s libraries to retrieve and set account information as well as authentication. Usually this is obtained from the /etc/passwd and the /etc/shadow file as well if shadow is enabled.

The account component performs the task of establishing the status of the user´s account and password based on the following shadow elements: expire, last_change, max_change, min_change, warn_change. In the case of the latter, it may offer advice to the user on changing their password or, through the PAM_AUTHTOKEN_REQD return, delay giving service to the user until they have established a new password. The entries listed above are documented in the shadow(5) manual page. Should the user´s record not contain one or more of these entries, the corresponding shadow check is not performed.

The authentication component performs the task of checking the users credentials (password). The default action of this module is to not permit the user access to a service if their official password is blank.

A helper binary, unix_chkpwd(8), is provided to check the user´s password when it is stored in a read protected database. This binary is very simple and will only check the password of the user invoking it. It is called transparently on behalf of the user by the authenticating component of this module. In this way it is possible for applications like xlock(1) to work without being setuid−root. The module, by default, will temporarily turn off SIGCHLD handling for the duration of execution of the helper binary. This is generally the right thing to do, as many applications are not prepared to handle this signal from a child they didn´t know was fork()d. The noreap module argument can be used to suppress this temporary shielding and may be needed for use with certain applications.

The password component of this module performs the task of updating the user´s password.

The session component of this module logs when a user logins or leave the system.

Remaining arguments, supported by others functions of this module, are silently ignored. Other arguments are logged as errors through syslog(3).


Turns on debugging via syslog(3).


A little more extreme than debug.


The default action of this module is to not permit the user access to a service if their official password is blank. The nullok argument overrides this default.


Before prompting the user for their password, the module first tries the previous stacked module´s password in case that satisfies this module as well.


The argument use_first_pass forces the module to use a previous stacked modules password and will never prompt the user − if no password is available or the password is not appropriate, the user will be denied access.


This argument can be used to discourage the authentication component from requesting a delay should the authentication as a whole fail. The default action is for the module to request a delay−on−failure of the order of two second.


When password changing enforce the module to set the new password to the one provided by a previously stacked password module (this is used in the example of the stacking of the pam_cracklib module documented below).


This argument is used to inform the module that it is not to pay attention to/make available the old or new passwords from/to other (stacked) password modules.


NIS RPC is used for setting new passwords.


The last n passwords for each user are saved in /etc/security/opasswd in order to force password change history and keep the user from alternating between the same password too frequently.


Try to maintain a shadow based system.


When a user changes their password next, encrypt it with the MD5 algorithm.


When a user changes their password next, encrypt it with the DEC C2 algorithm.


When a user changes their password next, encrypt it with the SHA256 algorithm. If the SHA256 algorithm is not known to the crypt(3) function, fall back to MD5.


When a user changes their password next, encrypt it with the SHA512 algorithm. If the SHA512 algorithm is not known to the crypt(3) function, fall back to MD5.


When a user changes their password next, encrypt it with the blowfish algorithm. If the blowfish algorithm is not known to the crypt(3) function, fall back to MD5.


Set the optional number of rounds of the SHA256, SHA512 and blowfish password hashing algorithms to n.


Ignore errors reading shadow information for users in the account management module.


Set a minimum password length of n characters. The max. for DES crypt based passwords are 8 characters.

Invalid arguments are logged with syslog(3).

All module types (account, auth, password and session) are provided.


Ignore this module.

An example usage for /etc/pam.d/login would be:

# Authenticate the user
auth required
# Ensure users account and password are still active
account required
# Change the users password, but at first check the strength
# with pam_cracklib(8)
password required retry=3 minlen=6 difok=3
password required use_authtok nullok md5
session required

(5), pam.d(5), pam(8)

pam_unix was written by various people.


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.

Free Software

Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.

Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.

Free Books

The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.

Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.

Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.