Root login Ubuntu VM on Azure

后端 未结 6 1696
情深已故
情深已故 2021-02-02 13:38

Installed Ubuntu Server LTS 14.04 from Azure library on Azure VM. Logged in as standard \"azureuser\" created by Azure with my password. Changed root password:

s         


        
6条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-02 14:31

    It's an old post but it happens sometimes. Here is what I solved after research.

    sample log

    $ azure vm extension set hm hm  CustomScript Microsoft.Azure.Extensions 2.0 --auto-upgrade-minor-version  -i '{"commandToExecute": "cp /tmp/sudoers.org /etc/sudoers"}' info:    Executing command vm extension set
    + Looking up the VM "hm"
    + Installing extension "CustomScript", VM: "hm" info:    vm extension set command OK
    

    For macOS user, here is simple steps. (at least you need node installed)

    npm install -g azure-cli
    azure login
    azure config mode arm  
    

    or asm, depends on your VM

    azure vm list    
    

    change mode if no VM listed

    copy sudoers file from other machine to /tmp/sudoers.default of you target machine

    backup sudoers

    azure vm extension set hm hm  CustomScript Microsoft.Azure.Extensions 2.0 --auto-upgrade-minor-version  -i '{"commandToExecute": "cp /etc/sudoers /tmp"}'
    

    copy default sudoers to /etc/sudoers

    azure vm extension set hm hm  CustomScript Microsoft.Azure.Extensions 2.0 --auto-upgrade-minor-version  -i '{"commandToExecute": "cp /tmp/sudoers.default /etc/sudoers"}'
    

提交回复
热议问题