The ssh server port command configures a listening port number for an SSH server.
The undo ssh server port command restores the default listening port number of an SSH server.
The default listening port number of the SSH server is 22.
Parameter | Description | Value |
---|---|---|
port-number | Specifies the listening port number of the SSH server. | The value is 22 or an integer ranging from 1025 to 55535. |
Usage Scenario
To prevent attackers from attacking the standard SSH listening port number, run the ssh server port command to configure a new listening port. This improves security.
Precautions
If the server is listening on port 22, the SSH client can log in successfully with no port specified. If the server is listening on another port, the port number must be specified.
Before changing the current port number, disconnect all devices from the port. After the port number is changed, the server starts to listen on the new port.
After the ssh server port port-number command is run, the numbers of IPv4 port and IPv6 port are both changed. To change the number of IPv4 port or IPv6 port separately, run the ssh { ipv4 | ipv6 } server port port-number command.