Recap of Last Lesson: We logged into the overthewire Bandit 0 level using SSH and are now presented with a prompt.
Objective: Find the password to the next level
- Password is in a file named ‘readme’
- ‘readme’ is in the home directory
How to: Lets observe a few things first. When SSHing into a new machine you always want to know what type of system you’re logged into, who you are logged in as, and what directory you’re in.
First, notice that when we logged in with SSH we were presented with a prompt. This type of prompt is typical of a *nix (Linux or Unix) type operating system. To validate this you can enter the command ‘uname -a’ and you will be presented with some information about the operating system that is currently running.
Note: At any time you see a command and wish to know more about the commands or “switches” that can be used with it you can access the manual on any *nix system by typing the command ‘man <command>’ for example ‘man uname’.
So great, we have discovered we are operating on a Linux machine. Now we want to who we are, and where we currently are at in our file system. There are two simple ways to do this. First, you can type ‘whoami’ and ‘pwd’, this will give you the current user you are logged into as well as printing your working directory. The other way is to look to the left of your prompt. Notice you have [bandit0@melinda:~] this is essentially saying user: bandit0 is current on machine melinda and is at home/bandit0. ~ is shorthand in Linux for the current users ‘home’ directory.
Now that we know we’re in the home directory, and according to our intel the filename we need is here, lets look whats in the directory. Enter ‘ls -al’ into your command prompt, again I urge you to read the manual pages for each command I give. Notice we have a file named “readme”, now we simply read this filename to find the password. Enter ‘cat readme’. Congrats! You now have the password to enter Level 1.
Terminate your SSH session by typing ‘exit’ and reconnect to the bandit game using your new username and password!.
Conclusion: We covered a few commands, if you’re to new to *nix I recommend you read the man pages for each of them and become comfortable with their application. Also, if you don’t know what it is take this time to research what “tab completion” is as it is helpful for command line.