Before connecting to the SCP server to manage files, complete the following tasks:
Table 1 describes the procedure for managing files when the device functions as an SCP server.
No. |
Task |
Description |
Remarks |
---|---|---|---|
1 |
Generate a local key pair, enable the SCP server, and configure SCP server parameters, including the listening port number, key pair updating time, SSH authentication timeout duration, and number of SSH authentication retries. |
Tasks 1, 2, and 3 can be performed in any sequence. |
|
2 |
Configure the VTY user interface for SSH users to log in to the device |
Configure the user authentication mode, SSH, and other basic attributes on the VTY user interface. |
|
3 |
Create SSH users and set the authentication mode and service type on the SCP server. |
||
4 |
Upload and download files on the SCP client. |
— |
Parameter |
Default Setting |
---|---|
SCP server function |
Disabled |
Listening port number |
22 |
Time for updating the key pair of the server |
0, indicating the key pair of the server is never updated |
SSH authentication timeout duration |
60 seconds |
Number of SSH authentication retries |
3 |
SSH user |
No SSH user is created. |
Type of service for SSH users |
No service type is supported. |
Operation |
Command |
Description |
---|---|---|
Enter the system view. |
system-view |
- |
Generate a local key pair. |
rsa local-key-pair create, dsa local-key-pair create, or ecc local-key-pair create. |
Perform one of the operations based on the key type. After the key pair is generated, run the display rsa local-key-pair public, display dsa local-key-pair public, or display ecc local-key-pair public command to check the public key in the local key pair.
NOTE:
For increased security, you are advised to use the longest possible length for the key pairs. |
Enable the SCP server function. |
scp [ ipv4 | ipv6 ] server enable |
By default, the SCP server function is disabled. |
(Optional) Configure a key exchange algorithm list for the SSH server. |
ssh server key-exchange { dh_group14_sha256 | dh_group15_sha512 | dh_group16_sha512 | dh_group_exchange_sha256 }* |
By default, an SSH server supports all key exchange algorithms. The system software does not support the dh_group_exchange_sha1, dh_group14_sha1, and dh_group1_sha1 parameters. To use the dh_group_exchange_sha1, dh_group14_sha1, or dh_group1_sha1 parameter, you need to install the WEAKEA plug-in. For higher security purposes, you are advised to use other parameters. |
(Optional) Configure an encryption algorithm list for the SSH server. |
ssh server cipher { aes128_ctr | aes256_ctr } * |
By default, an SSH server supports all HMAC algorithms. The system software does not support the aes256_cbc, aes128_cbc, 3des_cbc, and des_cbc parameters. To use these parameters, you need to install the WEAKEA plug-in. For higher security purposes, you are advised to specify the aes256_ctr or aes128_ctr parameter. |
(Optional) Configure an HMAC algorithm list for the SSH server. |
ssh server hmac sha2_256 |
By default, an SSH server supports the following HMAC algorithms: MD5, MD5_96, SHA1, SHA1_96, SHA2_256, and SHA2_256_96. The system software does not support the sha2_256_96, sha1, sha1_96, md5, and md5_96 parameters. To use the sha2_256_96, sha1, sha1_96, md5, or md5_96 parameter, you need to install the WEAKEA plug-in. For higher security purposes, you are advised to specify the sha2_256 parameter. |
(Optional) Configure the minimum key length supported during Diffie-hellman-group-exchange key exchange between the SSH server and client. |
ssh server dh-exchange min-len min-len |
By default, the minimum key length in Diffie-hellman-group-exchange between the SSH server and client is 1024 bytes. |
(Optional) Configure the listening port number. |
ssh [ ipv4 | ipv6 ] server port port-number |
By default, the listening port number is 22. If a new port number is configured, the SSH server disconnects all SSH clients and uses the new port number to listen for connection requests. Attackers do not know the port number and cannot access the listening port of the SSH server. |
(Optional) Configure the interval for updating the key pair of the server. |
ssh server rekey-interval hours |
By default, the interval for updating the key pair is 0, which indicates that the key pair is never updated. After the interval is configured, the system automatically updates the key pair at the specified interval, which ensures security. This command takes effect only for SSH1.X. However, SSH1.X provides weak security and is not recommended. |
(Optional) Specifies the public key algorithm of the SSH server. |
ssh server publickey { dsa | ecc | rsa } * |
By default, DSA, ECC, and RSA public key algorithms are enabled. |
(Optional) Configure the SSH authentication timeout duration. |
ssh server timeout seconds |
By default, the SSH authentication timeout duration is 60 seconds. |
(Optional) Configure the source interface of the SSH server. |
ssh server-source -i loopback interface-number |
By default, the source interface of an SSH server is not specified. NOTE:
Before specifying the source interface of the SSH server, ensure that the loopback interface to be specified as the source interface has been created. If the loopback interface is not created, this command cannot be correctly executed. |
(Optional) Configure the number of SSH authentication retries. |
ssh server authentication-retries times |
By default, the number of SSH authentication retries is 3. |
(Optional) Enable compatibility with earlier versions. |
ssh server compatible-ssh1x enable |
By default, the server's compatibility with earlier versions is disabled. When an SSH server is upgraded, the server's compatibility with earlier versions is the same as that in the configuration file. |
(Optional) Configure an ACL. |
ssh [ ipv6 ] server acl acl-number |
By default, no ACL is configured for the SSH server. An ACL is configured to determine which clients can log in to the current device through SSH. |
SSH users use the VTY user interface to log in to the device using SCP. Attributes of the VTY user interface must be configured.
Operation |
Command |
Description |
---|---|---|
Enter the system view. |
system-view |
- |
Enter the VTY user interface view. |
user-interface vty first-ui-number [ last-ui-number ] |
- |
Set the authentication mode of the VTY user interface to AAA. |
authentication-mode aaa |
By default, no authentication mode is configured for the VTY user interface. The authentication mode of the VTY user interface must be set to AAA. Otherwise, you cannot configure the protocol inbound ssh command and users cannot log in to the device. |
Configure a VTY user interface that supports SSH. |
protocol inbound ssh |
By default, the VTY user interface supports SSH. If no VTY user interface supports SSH, users cannot log in to the device. |
Configure the user level. |
user privilege level level |
The user level must be set to 3 or higher to allow connections to be established. If a local user uses password authentication, you can run the local-user user-name privilege level level command to set the level of the user to 3 or higher. |
(Optional) Configure other attributes of the VTY user interface. |
- |
Other attributes of the VTY user interface are as follows:
|
Operation |
Command |
Description |
---|---|---|
Enter the system view. |
system-view |
- |
Create SSH users. |
ssh user user-name |
- |
Configure the authentication mode for SSH users. |
ssh user user-name authentication-type { password | rsa | password-rsa | dsa | password-dsa | ecc | password-ecc | all } |
If SSH users are not created using the ssh user command, directly run the ssh authentication-type default password command to configure the default password authentication mode for users. This makes configuration simpler when a large number of users exist, because you need to configure only AAA users. NOTE:
In all authentication mode, the user priority depends on the authentication mode selected.
If all authentication is selected and an AAA user with the same name as the SSH user exists, user priorities may be different in password authentication and RSA/DSA/ECC authentication modes. Set relevant parameters as needed. |
Set the service type to all for SSH users. |
ssh user username service-type all |
By default, the service type of SSH users is empty. |
To configure password authentication for the SSH user, see Table 6.
To configure RSA, DSA, or ECC authentication for the SSH user, see Table 7.
To configure password-rsa, password-dsa, or password-ecc authentication for the SSH user, configure an AAA user and set the RSA, DSA, or ECC public key. For details, see Table 6 and Table 7.
Operation |
Command |
Description |
---|---|---|
Enter the system view. |
system-view |
- |
Enter the AAA view. |
aaa |
- |
Configure the local user name and password. |
local-user user-name password irreversible-cipher password |
- |
Configure the service type for the local user. |
local-user user-name service-type ssh |
- |
Configure the level for the local user. |
local-user user-name privilege level level |
- |
Return to the system view. |
quit |
- |
Operation |
Command |
Description |
---|---|---|
Enter the system view. |
system-view |
- |
Display the RSA, DSA, or ECC public key view. |
rsa peer-public-key key-name [ encoding-type { der | openssh | pem } ] , dsa peer-public-key key-name encoding-type { der | openssh | pem } , or ecc peer-public-key key-name encoding-type { der | openssh | pem } |
- |
Display the public key editing view. |
public-key-code begin |
- |
Edit the public key. |
hex-data |
|
Exit the public key editing view. |
public-key-code end |
|
Return to the system view from the public key view. |
peer-public-key end |
- |
Assign an RSA, DSA, or ECC public key to an SSH user. |
ssh user user-name assign { rsa-key | dsa-key | ecc-key } key-name |
- |
The SSH client software supporting SCP must be installed on the terminal to ensure that the terminal can connect to the device using SCP. The following describes how to connect to the device using OpenSSH and the Windows CLI.
For details how to install OpenSSH, see the OpenSSH installation description.
To use OpenSSH to connect to the device using SFTP, run the relevant OpenSSH commands. For details about OpenSSH commands, see OpenSSH help.
Windows command prompt can identify commands supported by OpenSSH only when OpenSSH is installed on the terminal.
Access the Windows CLI and run the commands supported by the OpenSSH to connect to the device using SCP. (The following information is for reference.)
C:\Documents and Settings\Administrator> scp scpuser@10.136.23.5:flash:/vrpcfg.zip vrpcfg-backup.zip
The authenticity of host '10.136.23.5 (10.136.23.5)' can't be established.
DSA key fingerprint is 46:b2:8a:52:88:42:41:d4:af:8f:4a:41:d9:b8:4f:ee.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.136.23.5' (DSA) to the list of known hosts.
User Authentication
Password:
vrpcfg.zip 100% 1257 1.2KByte(s)/sec 00:00
Received disconnect from 10.136.23.5: 2: The connection is closed by SSH server
C:\Documents and Settings\Administrator>
The user terminal uploads or downloads files while connecting to the SCP server and accesses the user local directory.
The file system limits the number of files in the root directory to 50. Creation of files in excess of this limit in the root directory may fail.
Run the display ssh user-information [ username ] command to view SSH user information on the SSH server.
Run the display ssh server status command to view global configuration of the SSH server.
Run the display ssh server session command to view session information of the SSH client on the SSH server.