Permissions on /etc/shadow

filespermissionsshadow

I am using Red Hat Enterprise Linux and here are the details:

uname -a
3.10.0-327.22.2.e17.x86_64 

When I check permissions on the shadow file I see the following:

ls -l /etc/shadow
----------. 1 root root 1467 /etc/shadow

I am surprised to see these permissions. I would think that 'passwd' would need at least read/write permissions for the owner to update this file. Any idea what is going on here?

Best Answer

That's normal.

passwd doesn't need read/write permissions as it's got the suid bit set, runs as root.

# ls -l /etc/shadow /usr/bin/passwd
---------- 1 root root   798 Jul 21 21:15 /etc/shadow
-rwsr-xr-x 1 root root 26688 Sep 10  2015 /usr/bin/passwd
#

More info at Stackexchange "How does the 'passwd' command gain root user permissions?" if you want it.

Related Question