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 unchangedSymptom 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.soorpam_pwquality.sois 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-passwordorsystem-authfile, references a module that does not exist, or contains incorrect parameters or module paths.Password policies are incorrectly configured. The
/etc/security/pwquality.conffile is incorrectly configured. As a result, thepam_pwquality.somodule 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.somodule exists.sudo find / -name "pam_unix.so"NoteIf the
pam_unix.somodule exists, check the configuration of the pam_pwquality.so module.If the
pam_unix.somodule 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.sois 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-modulesCentOS, Red Hat Enterprise Linux (RHEL), or Alibaba Cloud Linux
sudo yum reinstall pam
Check whether the
pam_unix.somodule 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.somodule, such as theModule is unknownandpam_chauthtok() failederror messages.Ubuntu or Debian
sudo tail -f /var/log/auth.logCentOS, RHEL, or Alibaba Cloud Linux
sudo tail -f /var/log/secureNoteThe 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.soSystem logs indicate that the
pam_pwquality.somodule cannot be loaded because thepam_pwquality.somodule is not installed or not installed in the correct directory.
Check whether the
pam_pwquality.somodule 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