How to connect to SSH port other than default 22

If you are trying to SSH on a remote server that is not running on the default port i.e. 22, you can connect to it by using the below syntax.


ssh user-name@server-name-or-ip -p <port-number>

Let's take a look at an example where we try to connect to port number 60 instead of 22.


% ssh admin@ -p 60
SSH to a non default port of 22 example

From SSH Man Page:

-p port: Port to connect to on the remote host. This can be specified on a per-host basis in the configuration file.



Facing issues? Have Questions? Post them here! I am happy to answer!

Author: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap