Ubuntu VM root entry on Azure

Ubuntu Server LTS 14.04 from the Azure library on Azure VM is installed. Recorded as a standard "azureuser" created by Azure with my password. Root password changed:

sudo passwd root 

If I try to log in as "root":

 Access denied 

What am I missing? And yes, the password is correct.

+6
source share
5 answers

By default, Ubuntu disables the root account. Since root is godmode, disabling it means that all hackers with automatic scripts that try to split the root account lose time.

I highly recommend against this. (There are many reasons, here are some of them: https://askubuntu.com/questions/16178/why-is-it-bad-to-login-as-root ) However, the steps are so Over on askubuntu.com

According to this page, to unlock the root account, you must run sudo passwd -u root . To block a root account, use sudo passwd -l root

Repeat: this is kind of a bad idea. The best solution would be to create a new user who has unlimited permissions ONLY IN THE FIELD OF WHAT YOU NEED. The root is the bogmod; if you are too much mistaken for you. On the other hand, an elevated user for your area could only destroy what it has access to ... not your entire system.

+11
source

Just run sudo -s , you will get the root terminal.

+19
source

To log in to Azure VM using SSH ...

First, you need to enable the root account:

 #sudo passwd root 

Then you need to enable root login for ssh by editing the file / etc / ssh / sshd _config (the default value in Azure VM is PermitRootLogin without a password, so you need to change / comment it):

 ... #PermitRootLogin without-password PermitRootLogin yes ... 

Finally, you need to restart / restart the ssh service:

 #sudo service ssh reload 
+3
source

It's easier to just do sudo <command> . Then you do not have a complete terminal for superuser. This will simply execute the command with root privileges. See this article .

+1
source

This is an old post, but sometimes it happens. This is what I decided after research.

sample magazine

 $ 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 the macOS user, here are the simple steps. (at least you'll need node)

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

or asm, depends on your virtual machine

 azure vm list 

change mode if no VM is specified

copy the sudoers file from another computer to /tmp/sudoers.default on your target machine.

standby 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"}' 
0
source

Source: https://habr.com/ru/post/971073/


All Articles