Enable root user on Linux(Ubuntu/RHEL) VM provided by Azure/AWS
1. Login to the Linux machine using Password/Key authentication.
2. Set password for root user and edit sshd_config file using following command.
sudo su
passwd root -- (Enter password for root user when prompted)
sudo sed -i 's/PermitRootLogin prohibit-password/#PermitRootLogin prohibit-
password/g' /etc/ssh/sshd_config
sudo sed -i 's/PasswordAuthentication no/#PasswordAuthentication no/g'
/etc/ssh/sshd_config
sudo sed -i '$ a PermitRootLogin Yes' /etc/ssh/sshd_config
sudo sed -i '$ a PasswordAuthentication yes' /etc/ssh/sshd_config
sudo sed -i '$ a PermitRootLogin without-password' /etc/ssh/sshd_config
sudo service sshd restart (for RHEL)
passwd root -- (Enter password for root user when prompted)
sudo sed -i 's/PermitRootLogin prohibit-password/#PermitRootLogin prohibit-
password/g' /etc/ssh/sshd_config
sudo sed -i 's/PasswordAuthentication no/#PasswordAuthentication no/g'
/etc/ssh/sshd_config
sudo sed -i '$ a PermitRootLogin Yes' /etc/ssh/sshd_config
sudo sed -i '$ a PasswordAuthentication yes' /etc/ssh/sshd_config
sudo sed -i '$ a PermitRootLogin without-password' /etc/ssh/sshd_config
sudo service sshd restart (for RHEL)