Tuesday, September 17, 2024

rw- directory mode : different ls behavior

Hello, I am studying OpenBSD and I am currently working on file mods and the chmod(1) command. In that context, I have come across a behavior that I don't understand. My test directory contains two files: ll.out and power.exe.

$ chmod 600 my-test-dir
$ ls -ld my-test-dir/
drw-------  2  user  user  512  Sep 17 11:13  my-test-dir/
$ ls my-test-dir
ll.out    power.exe
$ ls -l my-test-dir
total 0
$

I would expect that without the 'x' bit, the directory is not searchable and I won't be able to list its contents. But in fact I can, unless I use a long format (-l, -g or -n).

Can someone please explain the above behaviour? Thank you. Tom

No comments:

Post a Comment