Bandit Level 14
Bandit Level 14 — authenticate to SSH with a private key instead of a password.
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 in /etc/bandit_pass/bandit14 and can only be read by user bandit14. For this level, you don’t get the next password, but you get a private SSH key that can be used to log into the next level. Look at the commands that logged you into previous bandit levels, and find out how to use the key for this level.
Commands you may need to solve this level
ssh, scp, umask, chmod, cat, nc, install
Helpful Reading Material
Study guide
Level map: logged in as bandit13, gain access to bandit14.
What this level teaches
Public-key authentication, the way professionals actually log in to servers.
Key ideas
- Key pairs. A private key stays secret with you; the matching public key sits on the server. The server proves you hold the private key without the key ever crossing the network.
- Strict permissions.
sshrefuses to use a private key that other users can read, printing “UNPROTECTED PRIVATE KEY FILE”. Keys need mode600. ssh -i FILEnames the identity (private key) to use.- Copying files.
scpcopies files over SSH, and the same server can also connect back to itself.
How to approach it
- Find the key in your home directory and look at its permissions.
- Decide whether you will use the key from your own machine or from the server, and make the file permissions correct wherever it lives.
- Log in as the next user, then read that user’s password from the location the Level Goal gives. You will need that password for the next level.
Why it matters
Passwords get guessed and phished; keys are far harder to steal remotely. Almost every cloud server and Git host uses SSH keys.