2

I was trying to set something up so that I can SSH into my Raspberry Pi 4B from anywhere via remote forwarding. To do this I wanted to use PuTTY, specifically, I wanted to add a new forwarded port. However on PuTTY to set up a forwarded port it requires me to add a hostname and port in the format "host.name:port".The issue is that every time I write "raspberrypi:22" I try to connect and nothing happens. Have I made a mistake with the port number or formatting anything?

5
  • This is a Windows question
    – Milliways
    Sep 17, 2022 at 7:00
  • Please explain your network setup. If you just want to access your pi, easiest method is to forward the pi ssh port through your router. If your router wants you to use a specific port number, you can change ssh settings on the pi, but usually the option is at the router to forward port 22 to outside port 12345(example).
    – Abel
    Sep 17, 2022 at 13:01
  • so that I can SSH into my Raspberry Pi 4B from anywhere - putty won't help with that at all - I think you misunderstand how networking works Sep 18, 2022 at 3:10
  • yeah im a beginner to this lol, but couldn't i ssh into my pi from anywhere with remote forwarding? i can do that on putty via the "tunnels" setting adding a remote forwarding device Sep 18, 2022 at 4:00
  • i can do that on putty via the "tunnels" ... tunnels exist once the connection is made - what will you be connecting to in order to create the tunnel? Sep 19, 2022 at 9:47

1 Answer 1

0

Port forwarding in SSH is designed for SSH tunnels, not to forward your SSH connection to outside world.

To be able to connect to your Pi from outside you may setup port forwarding on your router, which generally a bad idea. Port forwarding is one of the least secure approaches for establishing remote communications. Better way is to set up VPN connection to you home network (can be often done using your internet router). VPN, however, is also not considered to be high security solution, you may want to learn about the alternatives. Depending in what you exactly want to achieve you may use one or another solution.

2
  • In the first website you linked on SSH tunneling the article reads "SSH tunnels allow connections made to a local port (that is, to a port on your own desktop) to be forwarded to a remote machine via a secure channel." Wouldn't this work for me? I'm trying to access my Pi via SSH from anywhere so that I can read text files on my Pi while I'm out somewhere else. Sep 20, 2022 at 15:34
  • Nope SSH tunnels are to tunnel traffic of another application over SSH. Meaning you should be able to SSH to your remote host in order to establish a tunnel. The typical use case is if you run an application on a remote host which starts a server on e.g. port 1234, you establish SSH connection to start the server with a tunnel forwarding the 1234 port to your local machine. After that you are able to connect to the server by connecting to your local machine on 1234 port.
    – Vadim
    Sep 22, 2022 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.