View the challenge on OverTheWire
π Goal
The password for the next level is stored in a file somewhere under the inhere directory. The file is human-readable, 1033 bytes in size, and not executable.
π Credentials
- Username:
bandit6
- Bandit 6 Password:
HWasnPhtq9AVKe0dmk45nxy20cvUa6EG
- Host:
bandit.labs.overthewire.org
- Port:
2220
π Useful Commands
find, cat, 2>/dev/null
π» Walkthrough
bandit6@bandit:~$ find / -type f -user bandit7 -group bandit6 -size 33c 2>/dev/null
/var/lib/dpkg/info/bandit7.password
bandit6@bandit:~$ cat /var/lib/dpkg/info/bandit7.password
π§ Explanation
πΉ Why find /?
The / tells find to start searching from the root of the filesystem. Since we donβt know where the target file is located, we have to search every directory on the system.
If you ran find . instead, it would only search the current directory and its subfolders β and you'd miss the file.
πΉ What does the find command do?
find / -type f -user bandit7 -group bandit6 -size 33c
This searches for files that meet all of these criteria:
-type f β it's a regular file
-user bandit7 β the file is owned by the user bandit7
-group bandit6 β the file belongs to the group bandit6
-size 33c β the file is exactly 33 bytes (the c suffix means "bytes")
πΉ Why add 2>/dev/null?
When searching from /, the find command will try to access restricted system directories, which throws lots of "Permission denied" errors.
To suppress that noise:
2>/dev/null
2 = standard error (stderr)
> = redirect
/dev/null = a "black hole" that discards the errors
This keeps your output clean, so you only see valid results like:
/var/lib/dpkg/info/bandit7.password
Bandit 7 Password
morbNTDkSW6jIlUc0ymOdMaLnOlFVAaj