Bandit Level 28 → Level 29

Katz85

Gebruiker
Lid geworden
14 mrt 2009
Berichten
76
Ik blijf vast hangen op het volgende level van overthewire. Ik heb het wachtwoord voor level 27 verkregen door de voorgaande opdracht en het lukt mij dan ook om hier mee in te loggen via SSH als bandit27. Echter de opdracht geeft aan dat het lokaal vanaf de machine moet gebeuren.


Ik gebruik het volgende commando om deze te verkrijgen:

Code:
bandit27@bandit:/tmp/tmp.Ks2cHlyUkh$ git clone ssh://bandit27-git@localhost:2220/home/bandit27-git/repo
Cloning into 'repo'...
The authenticity of host '[localhost]:2220 ([127.0.0.1]:2220)' can't be established.
ED25519 key fingerprint is: SHA256:C2ihUBV7ihnV1wUXRb4RrEcLfXC5CXlhmAAM/urerLY
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Could not create directory '/home/bandit27/.ssh' (Permission denied).
Failed to add the host to the list of known hosts (/home/bandit27/.ssh/known_hosts).
                         _                     _ _ _   
                        | |__   __ _ _ __   __| (_) |_
                        | '_ \ / _` | '_ \ / _` | | __|
                        | |_) | (_| | | | | (_| | | |_
                        |_.__/ \__,_|_| |_|\__,_|_|\__|
                                                      

                      This is an OverTheWire game server.
            More information on http://www.overthewire.org/wargames

!!! You are trying to log into this SSH server with a password on port 2220 from localhost.
!!! Connecting from localhost is blocked to conserve resources.
!!! Please log out and log in again.

backend: gibson-1
Received disconnect from 127.0.0.1 port 2220:2: no authentication methods enabled
Disconnected from 127.0.0.1 port 2220
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
 
Zelf snap ik er niks van maar dit schrijft Claude.

Het probleem zit 'm niet in je wachtwoord of aanpak, maar in deze regel:
Could not create directory '/home/bandit27/.ssh' (Permission denied).
Failed to add the host to the list of known hosts (/home/bandit27/.ssh/known_hosts).

Omdat SSH de host-key niet kan wegschrijven naar known_hosts (de homedirectory van bandit27 is niet beschrijfbaar in deze tmp-sessie), gaat de verbinding daarna mis en valt hij terug op een poging met wachtwoord-authenticatie. En juist wachtwoord-auth vanaf localhost is expliciet geblokkeerd door de server — vandaar de disconnect.

Oplossing: zorg dat SSH de known_hosts-check overslaat en niets probeert weg te schrijven, door dit via GIT_SSH_COMMAND mee te geven:
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone ssh://bandit27-git@localhost:2220/home/bandit27-git/repo

Wat dit doet:
  • UserKnownHostsFile=/dev/null → hij probeert de host key nergens op te slaan, dus geen permission-denied meer.
  • StrictHostKeyChecking=no → geen interactieve yes/no-vraag, dus geen risico dat hij daarna verkeerd afslaat naar password-auth.
Voer dit uit terwijl je nog steeds bent ingelogd als bandit27 (dus niet als bandit27-git), vanuit je tmp-directory. Daarna zou de repo gewoon gekloond moeten worden, en vind je het wachtwoord voor bandit28 in een bestand in die repo.
 
Terug
Bovenaan Onderaan