2

I've been working my way through bandit on OverTheWire, and I'm stuck on Level 27. The instructions for this level are as follows: "There is a git repository at ssh://bandit27-git@localhost/home/bandit27-git/repo. The password for the user bandit27-git is the same as for the user bandit27.

Clone the repository and find the password for the next level."

I've created a temp directory, and I'm running the git clone command, followed by the address of the repository from the temp directory. Here's a screenshot of what is happening when I run the command. From what I understand, I should be asked for a password, but I'm not prompted for a password, and am given the message "permission denied (publickey). fatal: could not read from remote repository. Please make sure you have the correct access rights, and the repository exists.

Can anyone provide insight on what I might be doing wrong?

So far I've tried changing the port that I connect to, which didn't work. I have also tried generating a ssh key, but I can't seem to find a /.ssh directory to copy it to. I'm a complete noob, so I'm probably doing something wrong there.

Jelly Lime
  • 31
  • 3
  • 1
    I have no idea what this "OverTheWire bandit" thing might be, but the first thing to do when having any trouble with git-via-ssh is to drop Git from the equation: run `ssh` directly, with options like `-Tv`, and observe ssh debug output. If ssh can't connect, Git (which just *runs* ssh) won't be able to connect via ssh. If ssh *can* connect and you can run commands, Git generally *should* "just work", although there are specific problems that can crop up here—but testing via ssh only, eliminating Git entirely, always comes first. – torek Nov 02 '22 at 13:42
  • What about appending `.git` to your clone command? `git clone ssh://bandit27-git@localhost/home/bandit27-git/repo.git` – Josh Friedlander Nov 02 '22 at 14:14
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Nov 02 '22 at 18:19
  • @torek: Thanks for your response. Over the wire is a game server built to teach basic linux and hacking skills. Bandit is the beginning level game on it. I tried your suggestion, and ran ssh bandit27-git@localhost -p2220, and got the following output: "fatal: interactive git shell is not enabled. hint: ~/git-shell-command should exist and have read and execute access." – Jelly Lime Nov 03 '22 at 03:36
  • @JoshFriedlander, thanks for responding. I tried your suggestion but got the same result as before. :( – Jelly Lime Nov 03 '22 at 03:37
  • OK, so it looks like the server's ssh-server on port 2220 inspects the incoming command but is intended to allow certain Git operations (similar to the way a `git@github.com` "login" works). Since you're going to `localhost`, presumably you can set up the required file. You'll need to make sure that your *Git* ssh command *also* uses port 2220 instead of the default port 22: you can configure this in ssh itself, or in Git using `core.sshCommand` or similar. – torek Nov 03 '22 at 08:22
  • @torek, thanks! I guess earlier when I tried changing the port I connect to, I was using the wrong syntax. I was able to connect with the following command: git clone ssh://bandit27-git@localhost:2220/home/bandit27-git/repo. That gave me the files I needed to find the password to the next level. Thanks again! – Jelly Lime Nov 03 '22 at 12:03

2 Answers2

2

git clone ssh://bandit27-git@localhost:2220/home/bandit27-git/repo worked for me as was stated above. I also had some trouble with the syntax to set the port to 2220... (i did a -p 2220, im fairly new to this stuff so lucky someone told the right way to do it :) )

user729073
  • 21
  • 3
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 25 '22 at 14:37
1

just add the port 2220

as in

ssh://bandit27-git@localhost:2220/home/bandit27-git/repo

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 14 '22 at 11:44