I'm currently following a small game to get more familiar with Linux and security and got the following task:
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.
Note: localhost is a hostname that refers to the machine you are working on
For now I'm logged in with the user bandit13 in the machine where user bandit14 exists and got the private key. When executing the ssh -i
command on the machine, logged in as bandit13, I get access to the bandit14 profile:
ssh [email protected] -i privatekeyfile
Now what bothers me is this: Can one log into your user account by just using the given SSH private key from any remote client? I tried to log in using my system, but the server refused my key. I tried using PuTTY on Windows and the terminal on Mac OS X with the same command. From what I know, the associated public key needs to be put into the authorized_keys file at the server (i.e. the machine that gets accessed). But why does logging in from the remote machine not work but from the local one?
Note: The public key is unknown. I have no access to the authorized_keys file on the server.
ssh-keygen -yf privatekeyfile
.