Linux – File permission. Write and execute only

file-permissionslinuxpermissions

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

Best Answer

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.

Related Question