GNU bug report logs - #79218
BUG: sudo rm -rf /* removes without --no-preserve-root

Previous Next

Package: coreutils;

Reported by: Doctorixx <jebpip2008 <at> gmail.com>

Date: Mon, 11 Aug 2025 15:11:01 UTC

Severity: normal

Tags: notabug

Full log


View this message in rfc822 format

From: Doctorixx <jebpip2008 <at> gmail.com>
To: 79218 <at> debbugs.gnu.org
Subject: bug#79218: BUG: sudo rm -rf /* removes without --no-preserve-root
Date: Mon, 11 Aug 2025 13:16:04 +0300
[Message part 1 (text/plain, inline)]
Hello coreutils maintainers,

I noticed a potentially dangerous difference in how rm handles the / and /*
patterns.

Currently:

$ sudo rm -rf /
rm: it is dangerous to operate recursively on '/'
rm: use --no-preserve-root to override this failsafe

This prevents accidental deletion of the root directory.

However:

$ sudo rm -rf /*

This command will proceed to remove the contents of /, effectively
destroying the system, without any warning.

While this is technically correct according to shell expansion rules, it
may be surprising for some users. People might assume /* is just as
protected as /, but the safeguard doesn’t apply.

P.S.: I removed root(
[Message part 2 (text/html, inline)]

This bug report was last modified 29 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.