I am unable to complete Day 13: SSH into an Azure Virtual Machine. Can you please guide me with the steps required to complete it. I tried multiple times trying to copy the SSH public key to the “authorized file” but I am facing a permission issue.
I think I am able to SSH now. But still this task failed. Please confirm.
Hi @MrSampath
Please refer to the solution here:
## Task: SSH into an Azure Virtual Machine
The Nautilus DevOps team is working on setting up secure SSH access for their virtual machines in Azure. One of the requirements is to add the SSH public key of the root user from the Azure client host (landing host) to the `datacenter-vm` Azure VM's `authorized_keys` file. This ensures secure and password-less SSH access to the VM.
#### Task Details:
- **VM Details:**
- The VM is named `datacenter-vm` and is running in the `West US` region. The default SSH user is `azureuser` — use this user to connect to the VM.
- You need to add the root user's SSH public key from the Azure client host to the `authorized_keys` file of the VM's root user.
- The SSH public key of the root user on the Azure client host is located at `/root/.ssh/id_rsa.pub`.
- **Public Key Addition:**
- Copy the public key located at `/root/.ssh/id_rsa.pub` on the Azure client host to the `authorized_keys` file of the root user on `datacenter-vm`.
- Ensure that the proper permissions for the `.ssh` folder and `authorized_keys` file are set on the VM.
- **Verification:**
- After adding the public key, make sure that you are able to SSH into the `datacenter-vm` VM as the `root` user from the Azure client host without needing a password.
#### Important Notes:
- Ensure that the VM is up and running before attempting to SSH.
- You may need to adjust the firewall or security group rules for the VM to allow SSH access.
---
This file has been truncated. show original
and compare it with your steps.
1 Like
Thanks Raymond.
I am still getting error. Please check the attached screenshot and advice.
Thanks @MrSampath
I’ll check it and get back.
@MrSampath
It is valid issue, I’ve forwared to the team to check and update it.
1 Like
I have also facing the same issue, I have completed the task and able to ssh with root user without password. But task given error on submission.
This one’s actually quite quick and easy:
Get a resource group for the azure-client’s account: az group list
Now use this command to get a public IP for our vm (say, xfusion-vm): az vm list-ip-addresses -g kml_rg_main-FROM-1 -n xfusion-vm
Get the public key for our azure-client: cat ~/.ssh/id_rsa.pub
ssh as azureuser to vm: ssh -i ~/.ssh/id_rsa azureuser@PUBLIC-IP
Become root: sudo -i
The /root/.ssh/authorized_keys` file has previous content – remove that and paste in the public key from the azure-client terminal from (3).
exit the vm.
test the vm by doing ssh -i ~/.ssh/id_rsa root@PUBLIC-IP.
That will pass the grader.
2 Likes
Thanks @rob_kodekloud
@Parveenrohilla
Please try again using Rob’s solution. I’m able to pass the task with it.