ls mystery

Ben Smithurst ben at
Tue Feb 17 00:01:03 GMT 2004

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Michael Abbott wrote:

> To be precise, on a directory the "r" bit allows you to access a file *if*
> you know its name, while the "x" bit allows you to list the files in the
> directory.

I'm too tired to figure out Frank's problem, but you've got this
backwards. "r" allows reading of the directory, "x" allows access to
files within it.

	ben at yellow:/tmp$ chmod 100 x
	ben at yellow:/tmp$ ls -l x
	ls: x: Permission denied
	ben at yellow:/tmp$ cat x/y

here, I can read the file, but not the directory.

	ben at yellow:/tmp$ chmod 400 x
	ben at yellow:/tmp$ ls -l x
	ls: x/y: Permission denied
	total 0
	ben at yellow:/tmp$ cat x/y
	cat: x/y: Permission denied

here, I can read the directory, although I cannot read the file.  Note
that I cannot stat the x/y file either, but ls does know it's there at

Ben Smithurst / ben at                 FreeBSD: The Power To Serve

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.4 (FreeBSD)



More information about the Ukfreebsd mailing list