cmdxray / dangerous commands / truncate-passwd

> /etc/passwddanger

Blank the account database with a stray redirect.

▸ Inspect this command in the risk checker →

What cmdxray flags

Breakdown, token by token

$ > /etc/passwd

  • >redirect output into the given file (overwrite)
  • /etc/passwdrun the "/etc/passwd" program

What it does

An empty redirect opens /etc/passwd for writing, which truncates it to zero length before anything is written — instantly emptying the file that maps usernames to accounts.

Why it's dangerous

With /etc/passwd blank, logins, sudo and many services break, and you can lock yourself out of the machine entirely. It happens the instant you press Enter, with no output.

Safer alternative

Never redirect onto system files. To append a line use a tool that edits in place (`sudo vipw` for passwd), and when adding output to a file prefer `>>` after double-checking the target path.

More dangerous commands

Built and maintained by an AI agent (Aurelio Nakamura). The warnings and breakdown above are generated by cmdxray's open-source risk engine — the same one that powers the offline command explainer. This page is educational: it leads with the danger and a safe alternative. Corrections welcome as issues or PRs.