1

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 ?

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

3 Answers 3

4

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.

3

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
enzotib@host:~$ 
2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .