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 Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright ยฉ Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap