Before using SFTP to access a device, enable the SFTP service on the device.
Perform the following steps on the device to be used as an SSH server:
For security purposes, do not use RSA keys whose length is less than 2048 bits. You are advised to use RSA_SHA2_256 and RSA_SHA2_512 instead.
The system view is displayed.
A public key encryption algorithm is configured for the SSH server.
Run the rsa key-pair maximum max-keys command to configure the maximum number of RSA key pairs that can be created.
Run the dsa key-pair maximum max-keys command to configure the maximum number of DSA key pairs that can be created.
Run the ecc key-pair maximum max-keys command to configure the maximum number of ECC key pairs that can be created.
If the user requirements for system security are not high, run the rsa local-key-pair create command to configure a local RSA key pair or run the dsa local-key-pair create command to configure a local DSA key pair.
If the user requirements for system security are high, run the ecc local-key-pair create command to configure a local ECC key pair.
If the user requirements for system security are not high, run the rsa key-pair label label-name [ modulus modulus-bits ] command to configure a local RSA key pair or run the dsa key-pair label label-name [ modulus modulus-bits ] command to configure a local DSA key pair.
If the user requirements for system security are high, run the ecc key-pair label label-name [ modulus modulus-bits ] command to configure a local ECC key pair or run the sm2 key-pair label label-name [ modulus modulus-bits ] command to configure a local SM2 key pair.
After keys are generated, run the ssh server assign { rsa-host-key | dsa-host-key | ecc-host-key | sm2-host-key } key-name command to assign a key pair to an SSH server.
If the authentication mode is set to x509v3-ssh-rsa, run the ssh server assign pki pki-name command to configure a PKI certificate for the SSH server.
Run the sftp ipv4 server enable command to enable the IPv4 SFTP service.
Run the sftp ipv6 server enable command to enable the IPv6 SFTP service.
SSH uses port 22 to listen to packets. Running this command will enable this port to listen to IPv4 and IPv6 TCP packets.
Encryption algorithms are configured for the SSH server.
For security purposes, you are advised to use secure algorithms such as aes128_ctr, aes256_ctr, aes192_ctr, aes128_gcm, and aes256_gcm.
HMAC authentication algorithms are configured for the SSH server.
For security purposes, you are advised to use sha2_256 or sha2_512.
A key exchange algorithm list is configured for the SSH server.
For security purposes, you are advised to use dh_group16_sha512 as the key exchange algorithm.
The minimum key length supported during diffie-hellman-group-exchange key exchange with the SSH client is configured.
If the SSH client supports the diffie-hellman-group-exchange key exchange algorithm with a length greater than 1024 bits, you are advised to run the ssh server dh-exchange min-len command to set the minimum key length to 3072 bits to improve security.
The configuration is committed.