Bandit 3 → 4: the empty directory that isn't
A directory that comes back empty, and isn’t. This is the level that teaches you
not to trust a blank ls — “hidden” on Linux is a much weaker idea than the
word suggests.
the goal
The password for the next level is stored in a hidden file in the
inheredirectory.
the approach
bandit3@bandit:~$ ls
inhere
bandit3@bandit:~$ cd inhere
bandit3@bandit:~/inhere$ ls
bandit3@bandit:~/inhere$
Nothing. Which is the level — ls leaves out anything whose name starts with a
dot, by convention, and says nothing about having done it.
I’ve been running ls -f since level 1 out of habit, so I tried it here and it
worked:
bandit3@bandit:~/inhere$ ls -f
. .. ...Hiding-From-You
Worth being precise about why that worked, though, because it’s not the flag
people mean. -a is the one for this — it means “show all”, including dotfiles.
-f means “don’t sort”, and switching off sorting happens to imply showing
everything. Same result, different reason. Reach for -a.
Then read it:
bandit3@bandit:~/inhere$ cat ./...Hiding-From-You
The ./ is reflex from level 1 again and isn’t needed — a leading dot is only
special to ls, not to cat. Costs nothing to leave in.
the takeaway
A dot at the front of a filename means “hidden”, and “hidden” only means ls
won’t list it by default. There’s no permission involved, no flag on the file,
nothing protecting it. It’s a display convention, one character deep.
So: ls -a to see everything, ls -la when you want the details too. And an
empty-looking directory is a reason to check, not a conclusion.