linux permissions on folders

2

AFAIK when i have r-- it means i can read the directory but not CD into it (according to the book). IIRC i can drop files in when i have -w- access. So why cant i copy files (i understand why i cant move) from d to my current directory? also note i am the owner of the file in d

-edit- I tested droping files into write only folders. It didnt work. I could have sworn i did it before. Does this mean copying and writing files can only be done if the X bit is set? what can i do when r or w is set but not x ?!?!

An employee

Posted 2009-09-17T14:50:45.360

Reputation:

Answers

3

You can't copy from a -w- directory because you also need execute access (-wx) to be able to parse the directory (directories are represented on disk by special files) to find the inode of the file you mean to copy.

You can find some documentation of the meaning of the bits in the chmod man page. In particular (from my Mac OS 10.5 machine):

0400 Allow read by owner.
0200 Allow write by owner.
0100 For files, allow execution by owner. For directories, allow the owner to search in the directory.

dmckee --- ex-moderator kitten

Posted 2009-09-17T14:50:45.360

Reputation: 7 311

0

With write permissions alone you can't do anything, since before writing to a directory, you must be able to access it. The execute permission specifies that a user or process can access the directory, such as the touch command while running.

read - list directory contents write - can create files only when write permission is enabled as well (300). execute - change to directory

although all options will allow you to rename a directory (via the mv command to the same directory).

John T

Posted 2009-09-17T14:50:45.360

Reputation: 149 037