4

I have a fresh installation of CentOS. I created a user and added it to wheel group (to add it to sudoers list).

I logged in with the credentials of new user. I then run the command cat useradd. Ideally, I should get a permission denied response. But the command worked and I got the details. I looked at the permissions with ls -al. Here is the screenshot :

enter image description here

It shows the owner is root, but it still showed the details to other user. Can anyone kindly explain what is going on here? Thank you.

(I am not that familiar with Linux. I have used it in past but it was a long time ago.)

  • The first line in that file tells you what it is: default values for useradd. – ott-- Jun 17 '16 at 20:20
  • 6
    Don't mess with the default permissions on system files unless you have a very specific reason to. The truly sensitive stuff is already locked down, and if you lock down files that shouldn't be locked down you may create problems for yourself. (E.g. if you restrict read access to /etc/passwd nothing will work right!) – Wildcard Jun 18 '16 at 0:27
15

Permissions

In the image you show that the "other" group has read permissions; if you tried to append echo testline >> useradd or execute ./useradd it would give you a permission denied. If you're looking to remove read permissions for the 'other' users you can use sudo chmod o-r useradd

  • Also, that they are not the root user nor in the root group – Jeff Schaller Jun 18 '16 at 0:08
7

I believe it is because the permission on the useradd file is set to rw-r--r--, thus giving read access to all users.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.