Problem description
In Linux, the system prompts "passwd:Permission denied" when changing the root password.
Solution
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.
- Check whether the
/etc/passwd
,/etc/shadow
, and/etc/pam.d
files have the required permissions. - By looking at the
/var/log/secure
log, you can see the prompt "several files do not exist, Module error" in the secure log. - 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
- 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
Scope
- Elastic Compute Service