Page 1 of 1

Permission Denied when change password even as root

Posted: 2019/09/06 22:19:39
by geolee76
We have this error message saying
Permission Denied
when attempt to change its own password as root user

the /etc/passwd is there and intact
there is another file /etc/passwd- in the same folder

Not sure what is the implications

We have tried reboot the server , however the error still persists

Re: Permission Denied when change password even as root

Posted: 2019/09/07 13:04:17
by TrevorH
Despite its name, /etc/passwd is not used for storing passwords. For that you want /etc/shadow which should look like:

Code: Select all

[root@centos7 ~]# ls -laZ /etc/shadow
----------. root root system_u:object_r:shadow_t:s0    /etc/shadow

Re: Permission Denied when change password even as root

Posted: 2019/09/14 19:16:32
by hunter86_bg
I have seen similar behavior in this forum.
Run

Code: Select all

vipw
and immediately try to save .
If it fails - find the offending line and fix it.

Also, check the SELINUX context of :

Code: Select all

ls -lZ  /etc/{passwd*,shadow*}
If they deviate from standards -> run a

Code: Select all

restorecon
to fix the files.