All Products
Document Center

:"passwd:Permission denied" is prompted when you modify the root password in Linux

Last Updated:Apr 12, 2022

Problem description

In Linux, the system prompts "passwd:Permission denied" when changing the root password.


Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management Console, we recommend that you modify such information in a timely manner.

Follow these steps to troubleshoot the problem.

  1. Check whether the /etc/passwd, /etc/shadow, and /etc/pam.d files have the required permissions.
  2. By looking at the /var/log/secure log, you can see the prompt "several files do not exist, Module error" in the secure log.
  3. Run the following commands to track the password change process. The strace log files are listed with the "/r" tag.
    strace -o /tmp/changepasswd passwd root
  4. Check the file format of /etc/pam.d/system-auth-ac. If the file format is DOS, run the following command to adjust the format:
    dos2unix system-auth-ac


  • Elastic Compute Service