The Goal

The password for Level 3 is stored in a file named --spaces in this filename-- in the home directory.

The Approach

Spaces in filenames trip up the shell because it uses spaces to separate arguments. To open a file with spaces, each space needs to be escaped with a backslash (\ ). Tab completion is particularly helpful here since the shell will auto-escape the spaces:

bandit2@bandit:~$ cat ./--spaces\ in\ this\ filename--
password

Commands Covered

  • cat ./name\ with\ spaces, open a file with spaces in its name using backslash escaping