How do I set or change the root password for my Linux instance?

1


1.    Connect to your Linux by using SSH.
2.    Assume root user permissions by running the following command:


$ sudo su



3.    Next, run the following command to create a password for the root user:


$ passwd root

4.    When prompted, enter your temporary root password, and then enter it again to confirm it.
Note: This command must be run as the root user.
After you finish the task that requires a temporary root password, delete the root password by running the following command:


$ passwd –l root