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)

   sudo service ssh restart (for Ubuntu)


 3. Start a new session and login as 'root' user.

Popular posts from this blog

Certification for Kubernetes? I got it covered.

Continuous Integrations Concepts and Demo

What Happens Under the Hood of SSH Connections? Analyzing SSH Packets with Wireshark.