Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

From this page, http://content.hccfl.edu/pollock/aunix1/filepermissions.htm, I understand that I need the +w bit set in a directory to create a new file and +x bit to cd into it/access its inode. So far, so good. But, I can't use vi/cat/nano/echo etc to do stuff like:

echo hello > dir/file

because I can't access inode of dir. My question is, how do I create/delete/rename a new file in dir if I can't access its inode ? Can I edit the directory structure using

vi dir

and create/edit/rename a new file? Is there a tutorial to do so ?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

If you don't have +x even if you have +w, you can not create new entries in the directory, neither files nor directories.

share|improve this answer
    
If you don't have +x, to my knowledge, you can't even cd to that directory? And if you can't even cd to that directory, it then implies you can't do any action into the directory? Why not chmod the directory and add +x on it? –  Darius Oct 14 '13 at 4:43
    
I wanted to understand the point of +w used alone on directories. So, even to create a new file, I need +x ? –  user2103008 Oct 14 '13 at 4:49

The x permission on directories is a "lookup" permission. It is needed to get hold of dentry in the directory by name.

Since each and every filesystem operation starts with a lookup on the target path, you have absolutely no access to content of a directory where you don't have x permission. There is thus no point in having w without x, because creating dentries in the directory requires lookup permission there.

The fact that you can't cd is kind of side-effect, because it looks up . inside the directory, not just the directory itself (you still can stat the directory).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.