First of all, I'm a complete newbie when it comes to network topics.

I'm using a Banana Pi for Samba, media center and other stuff at my home network. As I have a Hitron router I'm able to use Port Forwarding to access my local network from remote.

Setting up Port Forwarding at the router I found out that you can enter a different internal port than the external port. Now if I want to access my Banana Pi via SSH, is it possible to connect to it using another port than 22, i.e. 12345, to "hide" the accessibility of port 22 for others, so I just type abcd.efghij.klm:12345 into PuTTY (with my Banana Pi having a DynDNS configuration given of course) which would route to my router's ip at port 22?


Yes, it's possible to change the port. Just use the option to the right of the address.


Side note: if you're using the command line ssh client, you can specify the port as ssh -p <port> user@server. The port does not appear at the end of the address like it does in other URI schemes.

Edit: it's possible to have SSH configured to use any port that you like, as well as configuring your router to forward incoming ports to any other port. Make sure that you if your DNS record points to your router (somewhere in the DMZ I'm guessing), that you're connecting to the external port that you specified in your router, and that the internal port on the router is configured to the same port as your sshd agent.

  • I'm sorry, my question seems to be a bit unclear. I'm not asking how to change the port on PuTTY but if it's possible to configure my router to be connected to via port 12345 and forward it to port 22 by itself. – taiBsu Feb 1 '18 at 18:54
  • @taiBsu that's absolutely possible. It's also possible to configure the SSH agent to listen on a different port as well. – Ben Harris Feb 1 '18 at 18:57
  • Thanks a lot. Is there anything I will have to pay heed to, i.e. changing any configurations on the Banana Pi? – taiBsu Feb 1 '18 at 19:00
  • @taiBsu it's really up to you, but the default configuration (usually under /etc/ssh/sshd.config) specifies port 22, so it should be fine as long as the external port defined in your router configs points to the internal port 22. – Ben Harris Feb 1 '18 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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