I have a directory /usr/local/foo, which I need to remove.
This is going to be part of a script, which needs to be run as root.
I’m mainly worried that the directory, which contains things that users can edit, could contain something that causes a simple “rm -rf /usr/local/foo” to accidentally delete other things.
For example, if they managed to symlink foo to point to /dev or something and rm followed it.
Edit: additional information:
I don’t care about what’s in here, but I do care about stuff outside it. I just need to be able to delete it without the rm command deleting anything outside of the dir. I’m not worried about users losing data, they know about this, but I’m worried about them, for example, symlinking foo or foo/something to point to something external, like /dev, so that /dev gets removed when rm is run as root.
System: Ubuntu and FreeBSD and OSX