I would like to create a non deletable directory, from where i can create and move files from another location to this directory with read and write access ?

  • Excuse my ignorance, but isn't every directory deletable? – boehj May 7 '11 at 4:41
  • I'm not sure this is possible O.o – RolandiXor May 7 '11 at 4:54
  • @boehj Only the main directory should not be deletable, all the other sub directories can be deletable. – karthick87 May 7 '11 at 5:08
  • I won't delete this as it's a valid question that has accurate and acceptable answers. – Oli Jun 26 '11 at 15:18
  • Fine not a problem :) – karthick87 Jun 27 '11 at 14:17

Since you want a non removable dir, where you can create, paste, write and delete files you need to set the parent of this dir with non-writable permissions, and the dir with writable permissions. just as above, but taking consideration of group and everyone:

~$ mkdir -p parent/mydir
~$ chmod 755 parent
~$ chmod 777 parent/mydir

This wont let mydir to be deleted for everyone but you. And will let create and delete files within mydir, since this one has write permissions for everyone.


To prevent a directory to be deleted, its parent should be non writable:

enzotib@host:~$ mkdir -p parent/child
enzotib@host:~$ chmod -w parent/
enzotib@host:~$ rmdir parent/child/
rmdir: failed to remove `parent/child/': Permission denied

Read this for information on file permissions and how to apply them https://help.ubuntu.com/community/FilePermissions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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