No root login to Huawei switch

Latest reply: Nov 5, 2019 09:14:19 93 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 id_rsa.pub is different with the one in document

espl@ansible:~$ cat .ssh/id_rsa.pub
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:

Popeye_Wang
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/id_rsa.pub | egrep -v "BEGIN|END" | base64 -d | od -t x1 -An -w4 | tr 'a-f' 'A-F' | tr -d ' ' | fmt -w 48

  • x
  • convention:

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

  • x
  • convention:

BEST%20ANSWER!%20If%20you%20think%20I%20earn%20it!%3Cbr%2F%3E%3Cbr%2F%3EIf%20this%20post%20was%20useful%20to%20you%2C%20please%20click%20the%20%3Cimg%20id%3D%22aimg_eYhFO%22%20onclick%3D%22zoom(this%2C%20this.src%2C%200%2C%200%2C%200)%22%20class%3D%22zoom%22%20src%3D%22https%3A%2F%2Fforum.huawei.com%2Fenterprise%2Fen%2Fstatic%2Fimage%2Fcommon%2Fsupport01.png%22%20onmouseover%3D%22img_onmouseoverfunc(this)%22%20onload%3D%22thumbImg(this)%22%20border%3D%220%22%20alt%3D%22%22%20%2F%3E%20%3Cfont%20color%3D%22DarkOrange%22%3EHelpful%3C%2Ffont%3E%20button%20and%20flag%20my%20post%20as%20a%20%26quot%3BBEST%20ANSWER%26quot%3B%20so%20others%20can%20benefit.%20Thank%20you%20%3Cimg%20id%3D%22aimg_H808i%22%20onclick%3D%22zoom(this%2C

Comment

Reply
You need to log in to reply to the post Login | Register

Notice 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."
If the attachment button is not available, update the Adobe Flash Player to the latest version!
Login and enjoy all the member benefits

Login and enjoy all the member benefits

Login