Skip to contentSkip to conversation

x bit for dirs: misfeature?

DISCUSSION Thomas Hood 3 participants 3 messages Nov 20, 2001 – Nov 21, 2001

lore
Share & tools
lore
#0 lore raw

Please forgive me if I overlooked the message that already said this, but ...

James Sutherland wrote that "There are valid uses for X only directories (i.e. users are not allowed to list the contents, only to access them directly by name). R-only directories make little sense". Then there followed a long discussion about the utility of "--x" directories. (I agree that they aren't a very good idea, since an explorable directory can be "listed" by trial and error on the filenames within it.)

However, a decent reason for having separate r and x is that "r--" directories _do_ make sense. When a directory is "r--", its contents can be _listed_ but the
directory cannot be browsed. Observe: // Thomas Hood

jdthood@thanatos:~/tmp$ ls -l
total 8
drwxr-xr-x    2 jdthood  jdthood      4096 Nov 20 10:59 ./
drwx------   89 jdthood  jdthood      4096 Nov 20 10:55 ../
jdthood@thanatos:~/tmp$ mkdir --mode=777 test
jdthood@thanatos:~/tmp$ ls -l
total 12
drwxr-xr-x    3 jdthood  jdthood      4096 Nov 20 10:59 ./
drwx------   89 jdthood  jdthood      4096 Nov 20 10:55 ../
drwxrwxrwx    2 jdthood  jdthood      4096 Nov 20 10:59 test/
jdthood@thanatos:~/tmp$ touch test/1
jdthood@thanatos:~/tmp$ touch test/2
jdthood@thanatos:~/tmp$ ls -l . test
.:
total 12
drwxr-xr-x    3 jdthood  jdthood      4096 Nov 20 10:59 ./
drwx------   89 jdthood  jdthood      4096 Nov 20 10:55 ../
drwxrwxrwx    2 jdthood  jdthood      4096 Nov 20 10:59 test/

test:
total 8

drwxrwxrwx    2 jdthood  jdthood      4096 Nov 20 10:59 ./
drwxr-xr-x    3 jdthood  jdthood      4096 Nov 20 10:59 ../
-rw-r--r--    1 jdthood  jdthood         0 Nov 20 10:59 1
-rw-r--r--    1 jdthood  jdthood         0 Nov 20 10:59 2
jdthood@thanatos:~/tmp$ chmod ugo-x test
jdthood@thanatos:~/tmp$ ls -l . test
.:
total 12
drwxr-xr-x    3 jdthood  jdthood      4096 Nov 20 10:59 ./
drwx------   89 jdthood  jdthood      4096 Nov 20 10:55 ../
drw-rw-rw-    2 jdthood  jdthood      4096 Nov 20 10:59 test/

ls: test/.: Permission denied
ls: test/..: Permission denied
ls: test/1: Permission denied
ls: test/2: Permission denied
test:
total 0

jdthood@thanatos:~/tmp$ chmod ugo-r test
jdthood@thanatos:~/tmp$ ls -l . test
.:
total 12
drwxr-xr-x    3 jdthood  jdthood      4096 Nov 20 10:59 ./
drwx------   89 jdthood  jdthood      4096 Nov 20 10:55 ../
d-w--w--w-    2 jdthood  jdthood      4096 Nov 20 10:59 test/

ls: test: Permission denied

#1 lore raw
Quoted 4 lines · Thomas Hood

Please forgive me if I overlooked the message that already said this, but ...

Quoted 8 lines

James Sutherland wrote that "There are valid uses for X only directories (i.e. users are not allowed to list the contents, only to access them directly by name). R-only directories make little sense". Then there followed a long discussion about the utility of "--x" directories. (I agree that they aren't a very good idea, since an explorable directory can be "listed" by trial and error on the filenames within it.)

Finding filenames by trial and error is hopeless. It is _much_ easier to find the root
password by trial and error and then change the permissions and list in the normal way.
There is only one root password to guess, but you think having to guess _every_ filename is insecure?

A x-only directory is much safer than user security will ever be - you effectively have a password per file.

Quoted 5 lines

However, a decent reason for having separate r and x is that "r--" directories _do_ make sense. When a directory is "r--", its contents can be _listed_ but the
directory cannot be browsed. Observe: // Thomas Hood

But is that useful?
Sure, I can list filenames. I can't get at filesize or permissions. I can't open the files. How is that useful? Of course locking people out is useful, but why should they need to read the filenames?

Helge Hafting

#2 lore raw
In reply to Thomas Hood
Quoted 6 lines · Helge Hafting
Quoted 4 lines · Thomas Hood

However, a decent reason for having separate r and x is that "r--" directories _do_ make sense. When a directory is "r--", its contents can be _listed_ but the
directory cannot be browsed. Observe: // Thomas Hood

Quoted 7 lines

But is that useful?
Sure, I can list filenames. I can't get at filesize or permissions. I can't open the files. How is that useful? Of course locking people out is useful, but why should they need to read the filenames?

To taunt them? ;)