rm -Rf test /
rm: it is dangerous to operate recursively on ‘/’
rm: use --no-preserve-root to override this failsafe
GNU rm, but I don't know when it was introduced. rm -Rf test /
rm: it is dangerous to operate recursively on ‘/’
rm: use --no-preserve-root to override this failsafe
GNU rm, but I don't know when it was introduced.tl;dr That's when coreutils Ubuntu package switched from "--no-preserve-root" to "--preserve-root" by default.
edit: More info:
Remove write access to the parent directory, while keeping traversal and read rights, and you'll be sorted.
# touch /tmp/foo/.immutable
# chattr +i /tmp/foo/.immutable
# rm -rf /tmp/foo
It's not EXACTLY what you asked for, but the .immutable file cannot be deleted until you call chattr -i on it, which protects the directory....