How to make a folder can read write but can not remove itself?
I need open a folders to each custom as his or her home folder. To let he or she make new files, new child folders, edit rename and remove his or her files and folders. But forbid he or she remove his or her home folder.
I know if those home folder made under root, just like /homefolder, I can use the commend "chmod 1777 /homefolder". but if custom's home folder made in a authorized folder, just like /home/user/server/customNameFolder, that commend does not work. I have search on google and baidu just like this subject and some other same meaning words. But I have not got the answer. So I want to ask you if there is no way to get my goal? |
a simple solution i found here
http://binblog.info/2011/01/30/make-...able-on-linux/ the short of it is put a hidden file in their folder and make it immutable, since you can't remove an immutable file and you can't remove a non empty folder you can't accidentally delete the folder. |
Removing a directory ("folder") requires write permission in the parent directory. If that parent directory is owned and writeable only by root, then the user would not be able to delete that custom home directory.
|
Quote:
Quote:
Best regards, HMW |
Quote:
|
Quote:
|
Thank you very much!!!
Quote:
After that, I try to remove the testhome. It is forbidden. Make new file/folder, rename them, edit file, remove them, all the operate works great. Thank you. Thank you very much. Thanks for hmw and frieza too! |
Quote:
|
All times are GMT -5. The time now is 01:11 AM. |