Root Password in Ubuntu 22.04 server

set up root password

when we set up the ubuntu server in the virtual box VM it's likely that the root account is currently locked and does not have a password set. This is a security measure to prevent unauthorized access to the system.

But we can set a password because we have the sudo privilege to the user we created in the step of installing

  1. Log in as the user you created at the time of installing

  2. switch to root user with sudo

  3. set password for root and exit

  4. login as root

#This is the user you created at time ofinstaling
whoami
#switch to root user with sudo 
sudo su
#set strong password for root
passwd
# exit from roo
exit
# test weather we can login with new root password
su - root