Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a file "test" on an Ubuntu system owned by the root. The ls -l option is shown below.

$ ls -l test
-r--r----- 1 root abacus 373 Nov 12 19:19 test

I know that only the owner of a file can change its permission. But I want to know whether there is any way to read the contents of the file for an anonymous user.

share|improve this question

migrated from stackoverflow.com Mar 26 '13 at 6:08

This question came from our site for professional and enthusiast programmers.

    
You can look into sudo, setuid, and setgid to keep the ownership as root, but allow people to read it. –  Jess Mar 26 '13 at 1:16

2 Answers 2

Yes, you can add o+r, meaning, others can read:

chmod o+r test
share|improve this answer

No. As it is any anonymous reader can not read the files contents.

Right now the only people able to read the file are:

  • People with uid 0.
  • The owner. In this case the user called 'root', which is probably the same as the uid 0 user.
  • All people in the group 'abacus`. (Check /etc/groups to see who is in that group).

Then there is a category of people who are not in that group and who are not the owner. For these the file is set to unreadable. You can change that with chmod o+r test or with chmod +r test. (The latter sets it for all three in {user:group:other}).

All of this assume no additional ACLs (e.g. SElinux) are applied.

share|improve this answer
    
chmod o+x test will enable the execute permission, not the read permission, so that's won't do it at all, he needs chmod o+r test –  Pablo Fernandez heelhook Mar 26 '13 at 13:59
    
Whoops. Not sure how I went from thinking about explaining r, w and x, to writing x rather than r. Fixed now. –  Hennes Mar 26 '13 at 14:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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