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.)

2
  • The first line in that file tells you what it is: default values for useradd.
    – ott--
    Commented Jun 17, 2016 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
    Commented Jun 18, 2016 at 0:27

2 Answers 2

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

1
  • Also, that they are not the root user nor in the root group
    – Jeff Schaller
    Commented Jun 18, 2016 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .