Post

OverTheWire: Bandit Level 2 → Level 3

OverTheWire - Bandit

Level Goal

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
> whatis ls                                                                           
ls (1)          - list directory contents  

> whatis cd  
cd  (1)         - change working directory  

> whatis cat                                                                                                       
cat (1)         - concatenate files and print on the standard output  

> whatis file  
file (1)        - determine file type  

> whatis du    
du (1)          - estimate file space usage  

> whatis find  
find (1)        - search for files in a directory hierarchy

Note: All commands don’t have to be used to complete level

Helpful Reading Material

How to Read a Filename with Spaces in Linux

command line - How to access files/directories with spaces in the name? - Ask Ubuntu

Solution

View the files that are present in the current working directory using the ls command

1
2
bandit2@bandit:~$ ls  
spaces in this filename

View the content of the file named spaces in this filename using the cat command

Note: We command directly open this file as there are spaces in the filename. The spaces in the name can be escaped using \, another approach is to enclose the filename in ".." (quotes)

Note: The name of any file on the system can be auto-completed using the Tab key.

1
2
3
4
5
bandit2@bandit:~$ cat spaces\ in\ this\ filename  
UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK

bandit2@bandit:~$ cat "spaces in this filename"  
UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK

We have found the password for the next level !!

Logout of the current session and use the password of user bandit3 to access the next level

1
2
3
4
> ssh bandit3@bandit.labs.overthewire.org -p 2220  
This is a OverTheWire game server. More information on http://www.overthewire.org/wargames

bandit3@bandit.labs.overthewire.org's password: UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK
This post is licensed under CC BY 4.0 by the author.