LEVEL 2
Task
The password for the next level is stored in a file called -, located in the home directory.
Username: bandit1
Password: string provided in the readme file in the previous level
Theory
The task is similiar to Level 1 in that I have to locate the file with a dash (-).
Based on the previous level, I have determined that I will be in the home directory when I log in.
As such for this level, I will be only using the commands ls
and cat
.
However, the file name is a dash (-). Typing this in the command line might make the command think I’m trying to type in a command option, e.g. typing -p
means I’m choosing a port.
To located the - file, I will need to type in ./-
. This dot slash (./) helps to hide the dash (-) from the command.
Solution
Step 1: Log in using the username and password in the task.
Step 2: List out directory’s contents using ls
.
Step 3: Type in the command cat ./-
to read the contents in the file.
Level 2 completed.
28 Feb 2024 update: I learned that in Linux, a dash (-) followed by a character or word, is known as a flag:
Flags, also known as options or switches, play a crucial role in the command-line interface of Linux. They provide a way to modify the behavior of commands and enable additional functionalities. The behavior of Linux commands can often be changed by a number of Linux flags, sometimes known as options or switches.