OverTheWire: Bandit Level 2 →3
The password for the next level is stored in a file called spaces in this filename located in the home directory
Commands you may need to solve this level
ls, cd, cat, file, du, find
Helpful Reading Material
ssh firstname.lastname@example.org -p 2220
This is a OverTheWire game server. More information on http://email@example.com's password:
Note: The following solution works because there is only 1 file that starts with the word “spaces”
spaces in this filename
bandit2@bandit:~$ cat spaces*
Asterisks (*) in Linux
The “*” is one type of wildcard that we can used to match characters. In our case we are using it to match any files that start with the word “spaces”. This helps us not have to type out the remainder of the file name which has spaces. If we type in the name with spaces the command line interprets each word as a file name instead of the name of a single file.
bandit2@bandit:~$ cat spaces\ in\ this\ filename
bandit2@bandit:~$ cat 'spaces in this filename'
- “\” is an escape character and helps us preserve the literal value of a character. In our case the character we are trying to preserve is the space character. We don’t want the command line to interpret the space as meaning we are starting the name of a new file. Rather, we want to preserve its literal value as a “space” that helps make up the name of a file.
- Enclosing the name of our file in single quotes also helps us preserve the literal value of each character.
Single Quotes (Bash Reference Manual)
184.108.40.206 Single Quotes Enclosing characters in single quotes ('' ') preserves the literal value of each character within…