Permission Denied when change password even as root

Support for security such as Firewalls and securing linux
Post Reply
geolee76
Posts: 1
Joined: 2019/09/06 22:15:39

Permission Denied when change password even as root

Post by geolee76 » 2019/09/06 22:19:39

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

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Permission Denied when change password even as root

Post by TrevorH » 2019/09/07 13:04:17

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
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Permission Denied when change password even as root

Post by hunter86_bg » 2019/09/14 19:16:32

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.

Post Reply