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.

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 ?

share|improve this question
    
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

3 Answers 3

up vote 4 down vote accepted

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.

share|improve this answer

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:~$ 
share|improve this answer

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

share|improve this answer

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.