I would like to give my web server user (nginx) read access to the /etc/shadow file and I would like to confirm the steps that I am taking to do this. The system I am using is a CentOS 7.
- First I created a group called shadow:
groupadd shadow
- Then I added the web server user (nginx) to the group shadow:
usermod -aG shadow nginx
- Then I changed the owner to root and changed the file group owner to group shadow:
chown root:shadow /etc/shadow
- Then I allowed read permissions for all users in the shadow group to read the /etc/shadow file:
chmod g+r /etc/shadow
After conducting those steps I ran ls -l /etc/shadow
and I see the following output
----r-----. 1 root shadow 1390 Aug 30 12:51 /etc/shadow
Are these steps that I am following correct? Please let me know, and I can provide additional information if needed.