[Tutor] Permissions oddness
dman
dsh8290@rit.edu
Sun, 13 Jan 2002 23:39:23 -0500
On Sun, Jan 13, 2002 at 09:13:15PM -0500, Michael P. Reilly wrote:
| On Sun, Jan 13, 2002 at 08:14:18PM -0500, dman wrote:
| > For directories :
| > Read means you can list the contents.
| > Write means you can modify the contents.
| > Execute means you can 'cd' to the directory.
|
| FYI, the execute bit on a directory means more than just 'can you cd'.
| It allows a program to traverse into the directory to open files.
| Try this:
|
| import os
| os.mkdir('trythis', 0777)
| open('trythis/test.txt', 'w').write('hi there\n')
|
| os.chmod('trythis', 0666)
| f = open('trythis/test.txt', 'r')
|
| At this point, you'll get an exception of "Permission denied". We're not
| changing the current directory, just trying to access a file in it.
Ok, right, you're trying to descend into the directory. I guess
that's a better way to phrase it.
-D
--
"...the word HACK is used as a verb to indicate a massive amount
of nerd-like effort." -Harley Hahn, A Student's Guide to Unix