On 19 Jul 15:37, Chris G wrote:
I have just discovered that 'rm -f' (also 'rm -fr') only overrides permissions when run as root.
I.e. if I have a file I own that is read only I *can't* delete it if I am the user that owns the file, even using 'rm -f', however if I sudo to root privileges then 'rm -f' will remove the file even if there is no write permission.
Strangely the man pages on my system don't seem to document this difference between root and non-root use of rm. For the -f option it just says:-
`-f' `--force' Ignore nonexistent files and never prompt the user. Ignore any previous `--interactive' (`-i') option.
Which seems to be the non-root case, i.e. it *doesn't* remove a file where you don't have write permission even with '-f'. So where is the 'do it regardless of permissions' action which happens when root uses 'rm -f' documented?
Finally, the thing that caused the problem, how do I guarantee that an 'rm -fr' run by a user will be able to delete everything in the specified directory tree? Do I have to do a 'chmod -R +w' first?
Can you quickly look at the output of "alias", I'd bet on there being a magic option set in there.