How to connect to server via SSH with different port than 22

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?

1 Answer

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

putty

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.

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like