Bandit Level 7
Bandit Level 7 — search the whole server with find for a file owned by a given user and group, and silence permission errors.
Source: This content is aggregated from overthewire (MIT). Visit the original repository for the latest version.
Level Goal
The password for the next level is stored somewhere on the server and has all of the following properties:
- owned by user bandit7
- owned by group bandit6
- 33 bytes in size
Commands you may need to solve this level
ls , cd , cat , file , du , find , grep
Study guide
Level map: logged in as bandit6, find the password for bandit7.
What this level teaches
Using find on the entire filesystem with ownership filters, and handling the flood of “Permission denied” messages that results.
Key ideas
- Ownership. Every file has an owning user and group;
findcan filter on both with-userand-group. - Standard streams. Programs write results to stdout (file descriptor 1) and errors to stderr (2). Redirecting stderr with
2>/dev/nulldiscards the noise without hiding results. /dev/nullis a special file that swallows everything written to it.- Search scope. Starting from
/means every directory you cannot read produces an error.
How to approach it
- Combine ownership and size tests, starting your search at
/. - Redirect only stderr, so genuine results stay visible.
- Read the single remaining match.
Why it matters
Tracking down files by owner is how administrators audit permissions, and redirection is the basis of every shell pipeline you will write.