Quote:
Originally posted by vipas
How do we nail down UID that tries to delete a directory having no permission??
You get a list of candidates. Maybe that is every user on the system. Or maybe you can limit it down as you did. Maybe it's only those users who are a member of a particular group.
Let's say that your candidates are joe, harry, and fred.
Go to the parent directory.
mkdir fred.d
touch fred.d/file
chmod 700 fred.d fred.d/file
chown fred fred.d fred.d/file
Now only fred (or root) can delete "file". And no one can delete fred.d until after "file" is gone. So if fred tries to remove the parent directory, he will succeed with fred.d/file and then fred.d. But no one else could.
Naturally, you also make a joe.d and a harry.d as well. With most unix systems, chown is restricted to root. You will need root's help with this.