0

I am learning how to do SSH remote forwarding and I am trying to practice that using two virtual machines on my computer. One is runs Kali and hosts an apache web server configured to listen on port 8000 and the other runs Manjaro and should act as the remote device. (I have set the network adapters to "Bridged mode" in VB). When I run the command:

ssh -R 8080:localhost:8000 [email protected] 

It returns the following output:

[email protected]'s password: 
Last login: Sat Jul 30 16:09:45 2022 from 192.168.3.120
[manjaro@manjaro ~]$ connect_to localhost port 8000: failed.
connect_to localhost port 8000: failed.
connect_to localhost port 8000: failed.
connect_to localhost port 8000: failed.

It prints out the "failed to connect" line every time I insert: http://localhost:8080/ into the web browser on the Manjaro VM What can the problem be?

5
  • What does this have to SSH’ing into a machine this sounds like an Apache configuration issue. Without configuration files we cannot help you.
    – Ramhound
    Commented Jul 30, 2022 at 17:55
  • 1
    can you confirm the webserver is configured correctly by running curl localhost:8000 on the server? Commented Jul 30, 2022 at 18:06
  • I'm confused about which part of this is happening on which machine. Which system are you sshing from (192.168.3.120?), and which one are you sshing into (192.168.3.126)? Commented Jul 31, 2022 at 1:26
  • I think that the server is configured correctly; the output of curl localhost:8080 is this:pastebin.com/ypA2cbNZ
    – thom0075
    Commented Jul 31, 2022 at 10:44
  • You had been asked to test curl localhost:8000 but you tested curl localhost:8080. Didn't the discrepancy make you wonder? See my answer. Commented Jul 31, 2022 at 16:07

1 Answer 1

0

If (per your comment) curl localhost:8080 works on Kali, then you need -R …:localhost:8080 in your ssh command. In the command you used there is -R …:localhost:8000. The port is wrong.

ssh -R 8080:localhost:8080 [email protected]
#
#                           The machine with SSH server will listen
#      ^^^^                 on this port.
#
#                           The machine with SSH client will resolve
#           ^^^^^^^^^^^^^^  this address:port and it will forward
#                           connections to it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .