Conversation
Notices
-
[jasmine conf.d]# ls -al
total 16
drw-r----- 2 root http 4096 Aug 11 23:09 .
drwxr-xr-x 4 root root 4096 Oct 21 16:46 ..
-rw-r--r-- 1 http http 43 Aug 11 23:09 passwds
-rw-r----- 1 root http 741 Jul 19 21:11 ssl.conf
[jasmine conf.d]# cat passwds
skater:$[nope]
[jasmine conf.d]# sudo -u http cat passwds
cat: passwds: Permission denied
-
@Zerglingman http needs +x perms on the directory in order to access a file under it. +r only gives http the ability to see the contents of the directory. +x without +r is actually fine when the path is known.
-
@apropos I'd figured out the cause of it before posting, but I have never understood the difference between those for directories; I got as far as "you should set them both or it won't read", and haven't needed to understand any more than that. In particular,
>+x without +r is actually fine when the path is known.
is a cute trick.
>+r only gives http the ability to see the contents of the directory
[jasmine conf.d]# ls -al
total 16
drw-r----- 2 root http 4096 Aug 11 23:09 .
drwxr-xr-x 4 root root 4096 Oct 21 16:46 ..
-rw-r--r-- 1 http http 43 Aug 11 23:09 passwds
-rw-r----- 1 root http 741 Jul 19 21:11 ssl.conf
[jasmine conf.d]# sudo -u http ls
ls: cannot open directory '.': Permission denied
-
@Zerglingman # ls -ld /tmp /tmp/foo /tmp/foo/afile
drwxrwxrwt 14 root root 400 Nov 4 16:46 /tmp
drwxr--r-- 2 root root 60 Nov 4 16:46 /tmp/foo
-rw-r--r-- 1 root root 0 Nov 4 16:46 /tmp/foo/afile
# sudo -u git ls -l /tmp/foo
ls: cannot access '/tmp/foo/afile': Permission denied
total 0
-????????? ? ? ? ? ? afile
-
@apropos Is this a difference in implementation of ls?
-
@Zerglingman I think it's probably a parent permission issue, but if your ls has been rewritten in Rust or something, it might get confused by odd permissions
-
@apropos My memory is that it has always behaved like that, but I'm not sure if I've observed +r-x, or just -r-x where it's expected.
In any case, my understanding here is that my ls' current behaviour is to actually execute the directory, for some fucking reason.
Or not, maybe it's just being anal about perms on purpose:
[jasmine conf.d]# chmod 740 .
[jasmine conf.d]# sudo -u http ls
ls: cannot open directory '.': Permission denied
[jasmine conf.d]# chmod 710 .
[jasmine conf.d]# sudo -u http ls
ls: cannot open directory '.': Permission denied
[jasmine conf.d]# chmod 750 .
[jasmine conf.d]# sudo -u http ls
passwds ssl.conf