Unable to Login to DU-VM After Changing DU-Host SSH-Key

Problem

Unable to access on-prem management plane once the SSH-public key has been changed on the DU host VM.

[centos@onprem-du-host-5-3 .ssh]$ ssh centos@192.168.120.254
Permission denied (publickey)

Environment

  • Platform9 Edge Cloud - All Versions

Cause

  • SSH public key reset from the Host. [Generating new SSH key pair in the Host] and the DU VM being unaware about the new public key of the SSH.

Resolution

You need to copy the new SSH key [id_rsa.pub] into the DU VM /home/centos/.ssh/authorized_keys file to fix this issue. To resolve this issue, follow the below steps :

  1. To access DU VM via Single-User mode, login to the DU host server via SSH, List the DU VM with virsh commands to ensure the VM is in running status:

$ sudo virsh list --all
Id Name State

----------------------------------------------------

1 pf9-mplane running
  1. Now reboot the DU VM and access the VM console using the virsh command:

  1. In the console find the kernel line starting with linux16. And add rd.break at the end of this line. And press CTRL+X to resume the OS booting process with the new settings.

  1. Once you get the shell access, mount the /sysroot in rw read-write mode using the below command:

  1. To treat the directory as a root and to redirect to the shell prompt use

  1. After making any changes, it is recommended to relabel the file system to make all the applications start with the proper label.

  1. Now exit from the shell which will automatically boot the DU VM with newly added SSH key:

  1. Now, from the DU host, try to SSH into the DU VM using the below command. You should be able to login to the VM using the new SSH pub key added.

Last updated