Unknown password is asking

Guru Prasanna Shukla 0 Reputation points
2024-04-12T10:08:19.91+00:00

when i run this command "sudo apt-get update" then it asks me to enter password

i am uanble to understand which password is it asking

This question is related to the following Learning Module

Azure | Azure Training
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. AmaranS 7,280 Reputation points Microsoft External Staff
    2024-04-12T10:20:41.25+00:00

    Hi Guru Prasanna Shukla,

    According to our comprehension of the matter, you are engaged in the following Learn path exercise.

    We extend our gratitude for your participation in the Microsoft Q&A forum. 

    Based on our understanding of the issue, you are practicing the following Learn path exercise.  

    Subject: Microsoft Certified-Azure Fundamentals  

    Learning Path: Microsoft Azure Fundamentals: Describe Azure architecture and services.  

    Module: Describe Azure compute and networking services  

    Unit 3 of 14 : Exercise - Create an Azure virtual machine.  

    In the Exercise - Create an Azure virtual machine under Task 1: Create a Linux virtual machine and install Nginx we have two steps:  

    Step 1: To create a Linux VM using "az vm create" command and  

    Step 2: To configure Nginx on the VM created using "az vm extension set" command.  

    As mentioned in the exercise, we have used generate-ssh-keys for authentication while creating the VM using "az vm create" command rather than a password.  

    The "az vm extension set" command uses the Custom Script Extension to run a Bash script on your VM to configure Nginx.  

    We can successfully create a Linux VM and configure Nginx on the VM created by following the above steps of Task 1 and complete the exercise without any password. Kindly find the screenshots attached for reference.  

    Step1: User's image Step2: 

    User's image We don’t have to manually run the command "sudo apt-get update" separately. The Custom Script Extension used in "az vm extension set" command to run a Bash script takes care of invoking "sudo apt-get update" automatically with elevated permissions. By running the script, the command automatically runs 'sudo apt-get update' with the saved SSH key files.  

    If we manually run the command "sudo apt-get update"(not required as per the exercise), the system prompts us to enter a password.  

    User's image As we have used SSH key pairs for authentication rather than a password, we cannot enter a password.  

    If we want to connect to the VM created (without a password in this case for Linux VM) we need to do ssh to the vm created, before we can use sudo.  

    After completing Step 1, create a Linux VM of Task 1, make a note of the publicIpAddress that was assigned to the VM (for example:20.66.97.117).  

    Connect to the newly created VM using ssh (in cloud shell). We need to substitute the publicIpAddress noted above for <VM public ip address> in the command below:  

    "ssh azureuser@<VM public ip address>"  

    Enter 'yes' when you are prompted.  

    User's image Now we have successfully connected to the VM without using password and we can work in the VM. We can see our VM name as "my-vm" in the screenshot below which is same as given in "az vm create" command.  

    User's image Copy and right-click then paste the following commands below in the cloud shell window one after another. Wait for each command to complete before pasting in the next command.  

      1.sudo apt-get update  

      2.sudo apt-get install -y nginx  

    3.echo "<html><body><h2>Welcome to Azure! My name is $(hostname). </h2></body></html>" | sudo tee -a /var/www/html/index.html  

    User's image We can complete the Task 1 of the exercise successfully.  

    If we want to exit from the VM and come into CLI screen we use "exit" command.  

    User's image

    Please feel free to contact us if you have any additional questions.

    If you've found the provided answer helpful, please click the "Accept Answer/Upvote" button. This will be beneficial to other members of the Microsoft Q&A forum community.

    Thank you.

    1 person found this answer helpful.

  2. Marcin Policht 68,845 Reputation points MVP Volunteer Moderator
    2024-04-12T10:13:23.32+00:00

    That's the same password you used to sign in to the Azure VM


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.