When you run the passwd
command to change the password of a Linux Elastic Compute Service (ECS) instance, the passwd: Module is unknown
and passwd: password unchanged
error messages appear and the password fails to be changed. In most cases, the preceding issue occurs because exceptions occur in the Pluggable Authentication Modules (PAM) configurations related to password management or specific required PAM modules are missing or incorrectly configured. PAM is a suite of modules in Linux used for authentication and authorization.
Problem description
Symptom 1: You cannot change the password of the Linux ECS instance by using the passwd
command. The following error messages appear:
passwd: Module is unknown
passwd: password unchanged
Symptom 2: You cannot reset the password of the Linux ECS instance by using Cloud Assistant. The following error messages appear.
Possible causes
PAM modules are not installed or missing. A required PAM module such as
pam_unix.so
orpam_pwquality.so
is missing, or the file of a required PAM module is accidentally deleted or damaged.The PAM configuration file contains errors. The PAM configuration file in the
/etc/pam.d/
directory, such as thecommon-password
orsystem-auth
file, references a module that does not exist, or contains incorrect parameters or module paths.Password policies are incorrectly configured. The
/etc/security/pwquality.conf
file is incorrectly configured. As a result, thepam_pwquality.so
module does not work as expected.
Solution
Step 1: Check whether the pam_unix.so
module exists
Connect to the Linux ECS instance.
For more information, see Use Workbench to connect to a Linux instance over SSH.
Check whether the
pam_unix.so
module exists.sudo find / -name "pam_unix.so"
NoteIf the
pam_unix.so
module exists, check the configuration of the pam_pwquality.so module.If the
pam_unix.so
module does not exist, the corresponding library file may be damaged or the PAM package may not be installed. Re-install the PAM package.pam_unix.so
is a core PAM module that provides user management and password management services.
Re-install the PAM package.
Ubuntu or Debian
sudo apt-get update sudo apt-get install --reinstall libpam-modules
CentOS, Red Hat Enterprise Linux (RHEL), or Alibaba Cloud Linux
sudo yum reinstall pam
Check whether the
pam_unix.so
module exists.sudo find / -name "pam_unix.so"
Step 2: Check the pam_pwquality.so
module configuration
The pam_pwquality.so
module checks the strength of passwords, including the character types of passwords and whether passwords meet the minimum length requirement. If the pam_pwquality.so
module is enabled on the Linux ECS instance, you must meet the password complexity requirements of the module when you change the password of the instance.
Check system logs for error messages related to the
pam_pwquality.so
module, such as theModule is unknown
andpam_chauthtok() failed
error messages.Ubuntu or Debian
sudo tail -f /var/log/auth.log
CentOS, RHEL, or Alibaba Cloud Linux
sudo tail -f /var/log/secure
NoteThe following error messages appear:
PAM unable to dlopen(pam_puquality.so): /lib/security/pam_puquality.so: cannot open shared object file: No such file or directory PAM adding faulty module: pam_puquality.so
System logs indicate that the
pam_pwquality.so
module cannot be loaded because thepam_pwquality.so
module is not installed or not installed in the correct directory.
Check whether the
pam_pwquality.so
module is installed.sudo find / -name "pam_pwquality.so"
The following command output indicates that the module is installed:
/usr/lib/x86_64-linux-gnu/security/pam_pwquality.so
Step 3: Check whether you can change the password of the Linux ECS instance
Change the password of the Linux ECS instance.
passwd
If the password still fails to be changed or other error messages appear, submit a ticket to contact Alibaba Cloud technical support.