Got it

No root login to Huawei switch

Latest reply: Nov 5, 2019 09:14:19 273 2 0 0

According to the document. I can create rsa key pairs and upload the public key to the switch, then I can ssh to the switch.

I did it with command ssh-keygen but don't know how to upload to the switch. I tried ssh-copy-id root@switch but failed. In the document have to manually copy, paste into the console. The problem is that the format I have in the is different with the one in document

espl@ansible:~$ cat .ssh/
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5QhvE0iCZwM1LSk57vkbxb1APgXXeCM1tCUKsgpxrRcgag1FXSCmITsRTo/6WFBKdYPwe8yUKIB/yp3rUxsqGutPi/8fZngKlU7dyLVy6qjGm2v+XQo3mvMc8jTqvhxb1AomiE0ppne0bz0VQDBCOnOCnJP2VYKmheQgY0XbUklYHM4N8LcmyFMW7u9XB1NnQtIXfcHYtv5Hy7XhXYnRKvEvOQSEvLMaugczKNv7SVLJY4dSba5P3IG88JLmVjMA6qC5VZLP3aOqKVDBlsLd99Muz+ANZ9d4nBctQkGNJqh+TvCTvcBr9zxenG+50RB2aPW7SSwSnJ9b2XW58Gadr espl@ansible

But in the doc it is like below

huawei(config-rsa-public-key)#public-key-code beginEnter "RSA key code" view, return last view with "public-key-code end".

To then paste the converted public key, do as follows:

huawei(config-rsa-key-code)#30818602 8180E6B0 25E45C19 54F3DBAD D41C79BF 2054F2C9
huawei(config-rsa-key-code)#33775177 6F60F3B0 9654B03D 02A6A30F B04A5D59 E9BA7846
huawei(config-rsa-key-code)#32059FB6 1157F39B 2C60C890 9B92EFA6 CD566AE2 41621AEB
huawei(config-rsa-key-code)#7BC30538 7065BD5A E3D2380E F1ABF4BF A8EFB0C9 E9BB06E0
huawei(config-rsa-key-code)#8A060E0E 2022047C 009BA3F6 47257E1B B3498941 3C1281BA
huawei(config-rsa-key-code)#C5D64786 377B7426 2B5AA315 41C70201 25

 How to convert ? I tried to use putty but failed, and I'm using the Linux.

  • x
  • convention:

Admin Created Nov 5, 2019 04:03:41 Helpful(0) Helpful(0)

Hi JohnLee,
Try to run the following command to generate a hexadecimal public key and then import the public key to the switch:
ssh-keygen -e -m pem -f ~/.ssh/ | egrep -v "BEGIN|END" | base64 -d | od -t x1 -An -w4 | tr 'a-f' 'A-F' | tr -d ' ' | fmt -w 48

View more
  • x
  • convention:

Created Nov 5, 2019 09:14:19 Helpful(1) Helpful(1)

  • x
  • convention:



You need to log in to comment to the post Login | Register

Notice: To protect the legitimate rights and interests of you, the community, and third parties, do not release content that may bring legal risks to all parties, including but are not limited to the following:
  • Politically sensitive content
  • Content concerning pornography, gambling, and drug abuse
  • Content that may disclose or infringe upon others ' commercial secrets, intellectual properties, including trade marks, copyrights, and patents, and personal privacy
Do not share your account and password with others. All operations performed using your account will be regarded as your own actions and all consequences arising therefrom will be borne by you. For details, see " Privacy."

My Followers

Login and enjoy all the member benefits


Huawei Enterprise Support Community
Huawei Enterprise Support Community
Are you sure to block this user?
Users on your blacklist cannot comment on your post,cannot mention you, cannot send you private messages.
Please bind your phone number to obtain invitation bonus.