Web Hosting Talk







View Full Version : Non-deleteable directories?!


X-TechMedia
11-07-2002, 01:07 PM
Is it possible to create a directory that the user can write files to, delete files from etc, but cannot delete the actual directory?

I have tried various chmod and chown commands, but I can always delete the folder.

Any ideas?

jnestor
11-07-2002, 04:11 PM
A directory is just a file in it's parents directory. So if you want /home/user to not be deletable the user shouldn't have write permission in /home. They can create and delete files/directories under /home/user but can't delete /home/user itself.

If you want to have /home/user/web where they can add and delete files in /home/user/ then they'll be able to remove /home/user/web. AFAIK there's no combination of permissions that would prevent that.

PHBPendragon
11-08-2002, 11:45 PM
man chflags

chrisb
11-09-2002, 04:31 AM
Use the sticky bit, and chmod the directory to 1775.