ls mystery

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


--HcAYCG3uE/tztfnV
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
	foo

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
least.

--=20
Ben Smithurst / ben at FreeBSD.org                 FreeBSD: The Power To Serve
                                                    http://www.FreeBSD.org/

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFAMVm+bPzJ+yzvRCwRAkH/AKC+5v96+os+dXM/vY6PmcuJP1h8MQCgjyqi
Y/WSBixfcW104efzjGwsi/s=
=G80c
-----END PGP SIGNATURE-----

--HcAYCG3uE/tztfnV--




More information about the Ukfreebsd mailing list