Add a new SSH key to a virtual machine

Scenario

In this scenario, an RHEL 9-based Virtual Machine (VM) named exercise8 is currently in the Running state. The team has identified that the SSH key created by this VM has been lost. To regain SSH access, a new SSH key must be added to the VM.

Constraints

  • Access to the VM via the console is not possible because the user lab-user does not have password defined.

  • The new SSH key to be added is located at /home/userx/.ssh/id_rsa.pub.

Task

Perform the necessary steps to add the specified SSH key to the exercise8 VM to restore remote access.

08 break01
The primary goal is to get access to the exercise8 via SSH virtual machine restored.
Use virtctl ssh lab-user@exercise8 command to test the access.

Executing the lab script

In this exercise setup, ensure you are logged in to OpenShift cluster as user userx.

OpenShift login command
{login_command}

Once connected to the OCP cluster, run the command to break the lab.

Breaking the exercise
lab break exercise8

Console

After the break, you can log in to the OpenShift web console using your username and password or continue using the oc Command line at bastion to begin the troubleshooting process.

Username
userx
Password
{password}