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.

I have a directory that hangs off root:

/data/my/folder/here/ and /data/my/folder/herealso/

I wish all users to be able to write files to the here and herealso directories. But limit (as much as possible) their ability to do anything else.

What permissions do I need to set for data,my,folder,here and heralso directories to achieve this?

EDIT: I am after here and herealso to be write-only directories for all users. Since someone has recursively set /data to 777 permissions, I also I need the permissions set for the prior directories.

share|improve this question
    
What do you mean by "anything else"? With traditional Unix permissions, you have to give write access to the directory if you want users to be able to create files (and subdirectories). Can you use ACLs? –  slhck Apr 27 '13 at 16:03
    
I would prefer that they aren't allowed to read any files in the directory or execute anything in the directory. –  Cheetah Apr 27 '13 at 16:05
    
So, in essence you want a write-only directory for users? What real problem are you trying to solve, i.e. why do you need such a directory? Please edit and clarify your question. Thank you –  slhck Apr 27 '13 at 16:07
    
Yes, I want a write only directory for all users. –  Cheetah Apr 27 '13 at 16:08

2 Answers 2

The directories above here need just to be traversable so it's enough to

chmod o+x /data
chmod o+x /data/my
chmod o+x /data/my/folder

and then allow everybody to write (but not to read) on the lowest level

chmod 733 /data/my/folder here herealso

And if you want to automatically change the owner of the files to the owner of here

chmod 4733 /data/my/folder here herealso
share|improve this answer

I'ts pretty simple, fist go to that directory by typing(in a terminal):

cd /data/my/folder  

Now if you wish all users to be able to write and read files from those directories, type:

chmod 722 here herealso

That's all!
Edit: If you want the user only to be able to write to the folders, replace 766 with 722
Here is the explanation of numbers:
The first seven means the owner of the dir can do anything(that's normal)
The second digit are permissions for the users in the same group as the owner.
The last one is for the other users.
Remember this:
Read=4 ;Write=2; Execute=1;
To set an property, just add the numbers coresponding to the permisssions you want to set.
For example, If you want read + write, do : 4 + 2 = 6;(Read and write)
Write-only: 2
Read-only: 4;
Write and execute: 2 + 1 = 3
Sorry for my misunderstanding. Hope it helps

share|improve this answer
1  
I was under the impression that 777 permissions gave everyone permission to do anything. –  Cheetah Apr 27 '13 at 16:07
    
The OP just mentioned in a comment that they don't want others to read the file, and not give permissions to delete either. –  slhck Apr 27 '13 at 16:07

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.