Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

Which would be the right chmod value for a directory where everyone can write on it, but only the owner of the content can delete it?

I thought chmod 1755 path_to_directory would be the right one, but it isn't.

I am beginner on linux, i tried finding this on google, but i wasn't successful.

share|improve this question

marked as duplicate by Radu Rădeanu, Jorge Castro, Kevin Bowen, Eric Carvalho, Alvin Row Aug 14 '13 at 3:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
@RaduRădeanu Probably not. This question is really about making users own files they create in a particular directory (see the answer here; unlike that situation, ACLs are not needed here). –  Eliah Kagan Aug 14 '13 at 1:39

1 Answer 1

up vote 3 down vote accepted

You want to allow everyone to write to the directory, but restrict deletions to only the owner of the content. So, the right command would be:

chmod 1777 path_to_directory

The "others" must have write permission to create things (and the "sticky bit" restricts deletions). Read the man page of chmod to understand it better (man chmod).

An equivalent (and probably easier to understand) command is:

chmod a+rwx,+t path_to_directory
  • a+rwx adds read (r), write (w) and execute (x) permission to all (a)
  • +t adds the "sticky bit" to the directory (which restricts deletion of files/folders inside to just their owner)
share|improve this answer
    
This seems the solution to my problem. I will test it. –  Adrian George Aug 13 '13 at 19:22

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