public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: cygwin@cygwin.com
Subject: directory without search permission is searchable?
Date: Wed, 26 Feb 2020 05:30:00 -0000	[thread overview]
Message-ID: <06DDE076-BDA6-4877-BDD3-7F670CB38DB0@kba.biglobe.ne.jp> (raw)

It seems 'ls -l dir/file' or 'stat dir/file' succeeds even if
I don't have read/search permission for the 'dir'.

Create a directory and a file in it:

$ mkdir tmpdir
$ ls -ld tmpdir
drwxr-xr-x+ 1 takimoto none 0 Feb 26 12:46 tmpdir
$ touch tmpdir/afile
$ ls -l tmpdir/afile
-rw-r--r-- 1 takimoto 0 none Feb 26 12:46 tmpdir/afile

Remove all permissions from tmpdir:

$ chmod 0000 tmpdir
$ ls -ld tmpdir
d---------+ 1 takimoto none 0 Feb 26 12:46 tmpdir
$ getfacl tmpdir
# file: tmpdir
# owner: takimoto
# group: none
user::---
group::---
other::---
default:user::rwx
default:group::r-x
default:other::r-x

This fails as expected:

$ ls -l tmpdir
ls: cannot open directory 'tmpdir': Permission denied

But the followings succeed (should fail, I believe):

$ ls -l tmpdir/afile
-rw-r--r-- 1 takimoto none 0 Feb 26 12:46 tmpdir/afile
$ stat tmpdir/afile
  File: tmpdir/afile
  Size: 0               Blocks: 0          IO Block: 65536  regular empty file
Device: d05d00abh/3495755947d   Inode: 14636698789089092  Links: 1
Access: (0644/-rw-r--r--)  Uid: (197609/takimoto)   Gid: (197121/  none)
Access: 2020-02-26 12:46:12.478966400 +0900
Modify: 2020-02-26 12:46:12.478966400 +0900
Change: 2020-02-26 12:46:12.464849300 +0900
 Birth: 2020-02-26 12:46:12.464849300 +0900

Does this happen only for me? Should I set some ACL properly?

I removed default ACL from tmpdir but the results are the same.

I confirmed (by a simple C code) that the stat(3p) system call
(or library function) succeeds for 'tmpdir/afile'.



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

             reply	other threads:[~2020-02-26  5:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26  5:30 Jun T [this message]
2020-02-26  7:42 ` Thomas Wolff
2020-02-26 10:54   ` Corinna Vinschen
2020-02-26 16:10     ` Jun-ichi Takimoto
2020-02-26 16:16       ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=06DDE076-BDA6-4877-BDD3-7F670CB38DB0@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).