New VM on Azure setup to ssh access. Cant login, no Virtualmin/webmin Admin account exists

hi guys,
just installed a new ubuntu 16.04 vm on Azure.

in networking i open ports for http, https, ftp, and Virtualmin (10000)

During the Azure part of the setup i configured the vm for ssh access to work via public and private keys and am able to access the vm via putty. I note that i had the option in Azure to use a password to access the vm (i am assuming via active directory or something like).

when i installed virtulamin using the auto installer, i was unable to login via https://mydomain:10000 because it rejected my username and password.

I had to use putty to go in the Ubuntu O/S and manually enable the root user so i could then login to virtualmin.

sudo su
(entered new password twice)

When i got into webmin users i noticed that the only account in there was the new root account i had just created/enabled in putty.

what i dont understand, should setting the Azure VM to use ssh access make any difference to virtualmin admin account? (putty still requires a username and password to get into the server anyway)

Why didnt virtualmin have a usable account with which to login with?

Virtualmin doesn’t create an admin. It uses the admin user of the OS. Which is root or a sudo user.

In Ubnutu, root is disabled from logging in via ssh with a password and has no password set. If you just want root to work so you can login to virtualmin, then just set a root password like you did above. Root will still be unable to login via ssh password. If you have ssh keys setup, then you’re done. If you also want ssh root password login to work, you’ll have to edit /etc/ssh/sshd_config. Find line that reads “PermitRootLogin prohibit-password”. Change to “PermitRootLogin yes”. Then restart sshd. But would not recommend this as sshkeys is more secure.

The most secure way to do it would be to ssh in with keys as root, create a sudo user. Use that user as your virtualmin login, ssh login. leaving root with no password and no password login allowed. And keep the root sshkeys login as a backup.

Perhaps virtualmin auto installer needs altering to ask to create an administrator user for ubuntu?

Would solve this issue.