A Command Crossed Two Shells and Ran on the Wrong Host
Backticks inside a long task description survived the first shell and were executed by the second, on a different machine than intended. It deleted two gigabytes of archived journal. The lasting fix is a pattern: never interpolate free text into a nested ssh command.

Key Architectural Takeaways
- Free text containing backticks or dollar signs must never be interpolated into a nested ssh command string.
- Write the text to a file, copy it across, and have a small script read it, so no shell re-parses it.
- A side effect outside an approval flow is an incident even when no service was hurt.
The challenge
We were drafting a change proposal that included a long free-text description with markdown-style backtick-quoted code references. The proposal was entered by running a command over SSH on one host that wrapped another SSH hop: local shell, then ssh, then sudo bash -c '...'.
What happened
The backticks survived the first shell. Parameter expansion does not rescan its result, so the local shell passed them through. But when the whole string crossed the ssh hop, the remote shell parsed it again, and the backticked spans became real command substitution. They executed as root on the host we connected to, not on the host the proposal was about.
The effect was real, though contained: a journalctl --vacuum-size=300M ran and deleted about 2 GB of that host's archived systemd journal history. We confirmed no service was affected (the key services were all still active, uptime unchanged, no reboot). But it was an ungated action outside the approval flow, and the proposal itself was corrupted, with backtick spans replaced by command output or blanks. We denied that proposal with a note rather than approve garbage.
Root cause
Nested quoting. Every extra shell hop re-parses the string, and characters that are inert in the first shell become live in the second. This is not exotic: it is the standard way a string with or $()` goes wrong over ssh.
The pattern that fixed it
For any free-text proposal containing special characters:
- Write the text to a local file.
- Copy it to the target host with
scp. - Run a small script file, also copied rather than inline, that reads the text file's contents into the argument.
No shell ever sees the text as code. The next proposal arrived intact.
A second, separate observation
When the executing session for the clean proposal hit a real credential boundary and stopped to ask a follow-up question, the tooling still recorded it as completed with exit code zero. That was the second time we had seen a clarifying question reported as success, and we flagged it as worth fixing before a third.
Takeaway
Every shell hop is another parser. Move text with files, not with quotes, and treat a command that ran on the wrong host as an incident even when the damage was small.