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.

Example directory structure:

 /userA-directory/
        freespace-for-userA
        /THE-UNMOVABLE-UNRENAMABLE-PROTECTED-DIR/
             userA-files
             /userA-directories/
             freespace-for-userA

I want to give full write and create permissions inside the protected dir to some specific userA, but without letting userA rename or move that container dir. No touching the dirs name or location, but full freedom inside. And userA owns the parent directory as well.

What would be the best way to achieve this?

The current level of solution I could reach is this (with the help of @nobar):

How can I forbid a directories rename while allowing file creation operations inside and outside same directory?

share|improve this question
    
Your example is more complex than your description. What access do you want to provide for various-userA-files-and-directories? –  nobar Jun 23 '13 at 16:40
    
Since I don't understand the question well enough to write an answer, I'll just give a hint: use the "GROUP" feature of Linux filesystems (see chown and chmod for starters). –  nobar Jun 23 '13 at 16:42
    
Sorry for the complex example, I will simplify. –  Johan Jun 23 '13 at 18:09
    
I don't see a way to do that directly. You might be able to solve your problem by using a symbolic link to a directory at another location. –  nobar Jun 23 '13 at 20:56
add comment

1 Answer

What you are trying to do, if I understand it, is quite common -- this is just creating a shared folder.

Maybe what you are missing is the fact that renaming a directory is not controlled by the same permission as modifying the contents of that directory -- the name of the shared directory is protected at the level of its parent directory.

In the simplest case, all you need to do is:

chmod o-w parent ## prevent others from modifying the parent directory
chmod o+rwx parent/THE-UNMOVABLE-UNRENAMABLE-PROTECTED-DIR ## others can write

But the preceding will allow any user to modify the shared directory. For a more sophisticated setup you might manipulate the OWNER and/or GROUP of the target directory:

/parent -- OWNER:you, GROUP:you
   /THE-UNMOVABLE-UNRENAMABLE-PROTECTED-DIR/ -- OWNER:userA, GROUP:userA
      /userA-files-and-directories/ -- OWNER:userA, GROUP:userA

Use chown and/or chmod to manipulate the properties of THE-UNMOVABLE-UNRENAMABLE-PROTECTED-DIR. You can see the properties using ls -l.

You might choose to set the OWNER and GROUP to separate values, but this is probably only necessary if you want to allow multiple users while also controlling who has access.

share|improve this answer
    
Thank you for the answer, but it is not exactly what I needed. The parent directory is userA space. I will clarify the question a bit more. –  Johan Jun 23 '13 at 19:31
add comment

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.