To connect to a Linux server via SSH using a port other than the default port (22), you can use the option ‘-p’ as shown below.
ssh username_on_server@serveraddress.com -p custom_port_number Or ssh username_on_server@server_ip_address -p custom_port_number
Using a custom SSH port can make it more difficult for hackers to breach your server environment.