1

Is there any way to take away the owner's permission to read a file in macOS? I know there's no reason to do this but I have to for school and I can't find an answer anywhere.

Removing my write permission works fine but when I try to remove my read permission it automatically gives me read and write permissions back.

As you can see in the console output below, when I use chmod -v -v (extra verbose) it shows the correct permissions it should be changed to, but then when checking afterwards the permissions haven't changed.

thijs@Thijss-MacBook-Air-2 week6 % ls -l
total 16
-rw----r--  1 thijs  staff  12 Oct 11 21:10 greeting.txt
-rw-r--r--  1 thijs  staff   0 Oct 11 21:10 hello.txt
-rw-------  1 thijs  staff  15 Oct 11 21:11 weather.txt
thijs@Thijss-MacBook-Air-2 week6 % chmod -v -v u-w weather.txt 
weather.txt: 0100600 [-rw------- ] -> 0100400 [-r-------- ]
thijs@Thijss-MacBook-Air-2 week6 % ls -l 
total 16
-rw----r--  1 thijs  staff  12 Oct 11 21:10 greeting.txt
-rw-r--r--  1 thijs  staff   0 Oct 11 21:10 hello.txt
-r--------  1 thijs  staff  15 Oct 11 21:11 weather.txt
thijs@Thijss-MacBook-Air-2 week6 % chmod -v -v u-r weather.txt 
weather.txt: 0100400 [-r-------- ] -> 0100000 [---------- ]
thijs@Thijss-MacBook-Air-2 week6 % ls -l
total 16
-rw----r--  1 thijs  staff  12 Oct 11 21:10 greeting.txt
-rw-r--r--  1 thijs  staff   0 Oct 11 21:10 hello.txt
-rw-------  1 thijs  staff  15 Oct 11 21:11 weather.txt
4
  • 1
    This actually should work :-) What is the result of ls -ald .? Does it work if you run chmod 0 weather.txt?
    – nohillside
    Oct 12 at 7:35
  • 1
    Have you try chmod u-rw weather.txt At home this is ok for me.
    – Jean_JD
    Oct 12 at 8:42
  • 1
    Pointing out that unless you change the owner of the file, the rights can just be given back as long as the owner has rights on the containing directory. Oct 12 at 15:25
  • sudo chmod u-r filename
    – Ptit Xav
    Oct 12 at 15:37

You must log in to answer this question.

Browse other questions tagged .