The password file is named spaces in this filename. The shell splits unquoted arguments on whitespace, so the filename has to be quoted or escaped to be treated as one argument.
| Platform | OverTheWire Bandit |
| Category | Linux Fundamentals |
| Level | 2 → 3 |
| Difficulty | Beginner |
| Technique | Shell quoting and escaping |
Level 2's home directory has one file, but its name contains spaces. In a shell, unquoted spaces separate arguments — so typing the filename as-is splits it into several nonsense arguments instead of one filename.
"Level Goal: The password for the next level is stored in a file called spaces in this filename located in the home directory."
Log in as bandit2, then list what's there:
ls
spaces in this filename
Wrap the whole name in double quotes so the shell treats it as a single argument:
cat "spaces in this filename"
[PASSWORD FOR bandit3]
Backslash-escaping each space works identically, and is what shell tab-completion generates automatically:
cat spaces\ in\ this\ filename
[PASSWORD FOR bandit3]
The password is deliberately hidden — follow the method, you've earned it. 💪
Whenever a filename might contain spaces (or other shell-special characters), quote it or escape it — and when in doubt, let tab-completion do it for you instead of typing it by hand.
ls shows an empty folder — until you remember dotfiles don't show by default. Uncovering a hidden password file.
Discuss this writeup with the community on the CTFdojo Discord.
Join the Discord →