File permission. Write and execute only?

6

Is there any use if a file has only write and execute permission and not read permission?

Nitish

Posted 2011-01-11T14:30:08.963

Reputation: 181

Answers

7

There are uses for most objects you will find in a filesystem:

Directories: -wx would let you be in the the directory, create & modify files in it, but not list its contents. --x is sometimes used for directories as a security-through-obscurity measure, for instance on /home so people can't see what other users exist via their footprint in /home (though note well: obscurity on its own is no security - in the case of hiding the contents of /home a user can usually read the same information from /etc/passwd anyway)

Named Pipes: The execute bit has no meaning for a pipe so this is the same as -w- meaning you can write to the pipe but not read from it (so you can't see what other writers are putting into the pipe or disrupt the reader).

Device Nodes (as usually found under /dev): Similar to named pipes - you could write to the device but not read from it.

Normal Files: -w- would allow a user to append to a file, but not read existing data. Execute permission would not be very useful here, but you could have some very weird executable that used the back end of itself for configuration and allow the user to modify that config without reading the rest of the binary. I can't imaging this would be useful or at all safe though.

David Spillett

Posted 2011-01-11T14:30:08.963

Reputation: 22 424

2

Permissions like this can be used for drop box like functions on a folder, though you typically wouldn't use the write permission in that case. Other than that I haven't seen a lot of use for only write and execute. Thinking...

Wilersh

Posted 2011-01-11T14:30:08.963

Reputation: 129

Write+execute+sticky would result in an usable drop-box. – user1686 – 2011-01-11T14:34:50.877

If a file has to be executed, it needs to be read first right? – Sathyajith Bhat – 2011-01-11T15:17:43.013

In the context of a file: If it's a binary executable it doesn't have to be readable to be executed, if it needs to exec an interpreter that then reads the program (#! stuff) then it needs to be readable. – Kjetil Jørgensen – 2011-01-11T15:20:11.803