< Home

ssh server port

Function

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.

Format

ssh [ ipv4 | ipv6 ] server port port-number

undo ssh [ ipv4 | ipv6 ] server port

Parameters

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.

Views

System view

Default Level

3: Management level

Usage Guidelines

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.

Example

# Set the listening port number of the SSH server to 1025.

<HUAWEI> system-view
[HUAWEI] ssh server port 1025

# Set the IPv4 port number of the SSH server to 1025.

<HUAWEI> system-view
[HUAWEI] ssh ipv4 server port 1025
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >