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.

Sample Output
Copy

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:
Bash
Copy
Bash
Copy
  1. Now reboot the DU VM and access the VM console using the virsh command:
Bash
Copy
  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.
Bash
Copy
  1. Once you get the shell access, mount the /sysroot in rw read-write mode using the below command:
sh
Copy
  1. To treat the directory as a root and to redirect to the shell prompt use
sh
Copy

6. Now append the new SSH public key [id_rsa.pub] of the DU host into the below file in the DU VM and save it. And restart the sshd service:

sh
Copy
  1. After making any changes, it is recommended to relabel the file system to make all the applications start with the proper label.
sh
Copy
  1. Now exit from the shell which will automatically boot the DU VM with newly added SSH key:
sh
Copy
  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.
Bash
Copy
VariableType to search · ESC to discard
GlossaryType to search · ESC to discard
InsertType to search · ESC to discard
No matches