Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Linux$ rm someFile.txt
rm: remove write-protected file `someFile.txt'? y
Linux$ ls -l someFile*
ls: someFile*: No such file or directory
I am able to remove the file, even though I don't own the file, and I
don't have write permissions on the file, either. True, I do have write
permissions on the parent directory that holds the file. Maybe that's
why Linux lets me remove it?
What I'd like is to be able to set up permissions or other mechanisms
so that anybody can create a file in a directory, but if you don't own
the file or don't have write permisson on the file, then you can't
delete the file. Is that possible?
RESTRICTED DELETION FLAG OR STICKY BIT
The restricted deletion flag or sticky bit is a single bit, whose interpretation depends
on the file type. For directories, it prevents unprivileged users from removing or
renaming a file in the directory unless they own the file or the directory; this is
called the restricted deletion flag for the directory, and is commonly found on world-
writable directories like /tmp. For regular files on some older systems, the bit saves
the programís text image on the swap device so it will load more quickly when run; this
is called the sticky bit.
some files are owned by system of linux... its protected by system and denied from deleting in its directory coz, the system are using that file... But technically, if the file is write protected, you can't remove the file...:-D
Deleting a file writes to the directory and not the file. Since you have write access to the directory, you can delete a root owned file.
Those permissions are horrible for a home directory. You could use tmp instead as a globally writable directory, or create one for that purpose. If you look at the permissions of the /tmp directory, you will see that it has the sticky bit set.
A directory created for a globally writable samba share will have the same permissions, for the same reason. The "Samba 3 by Example" book (available in the samba-doc package) has a sample simple share including the steps to create the directory and subdirectories, including the permissions.