Shared server guidance · Question & answer

How do I connect when SSH uses a different port?

For ssh, specify a nondefault server port with lowercase -p. The port must already be configured on the server and permitted by its network policy. Adding this client option does not change the server’s listening port.

BeginnerWindows 11 with Microsoft OpenSSH Client; Windows PowerShell 5.1 or PowerShell 7 as labelledLinux VPS and dedicated servers where a remote Linux command is shown
Go to the answer

Instructions

1. Test the assigned TCP port

Use the actual port from your server connection details. Port 2222 is only an example.

Local Windows PowerShell
Test-NetConnection 203.0.113.10 -Port 2222

TcpTestSucceeded reports whether this Windows computer established a TCP connection. It does not verify SSH authentication.

2. Connect with the selected port

The same SSH invocation works in CMD. If you use a key, retain your existing -i option as well.

Local Windows PowerShell
ssh -p 2222 adminuser@203.0.113.10

Lowercase -p selects the SSH server port. SCP and SFTP instead use uppercase -P.

3. Verify the port-specific host identity

Known-host records for nondefault ports include the hostname and port. Treat a first connection on this port as a host-identity check; do not assume another service at the address is the intended SSH daemon.

Check the result

  • The TCP port is reachable from your current network.
  • The SSH session authenticates to the intended server after host verification.

Troubleshooting

Port 22 works but 2222 fails
Confirm the provider’s actual assigned port; do not change the server merely to match the example.
SSH says connection closed after TCP succeeds
Another service or an access policy may be on that port. Check server logs through an authorised existing session or console.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.