linux change root password code example

Example 1: change password linux

passwd userNameHere

Example 2: linux change user password

passwd $user

Example 3: change linux user password

#if you dont't have your root password => then don't use sudo command

# passwd <username>
Current password:
New password:
Retype new password:
passwd: password updated successfully

Example 4: replace password root

Step 1: Open a Terminal Window.
    		Right-click the desktop, then left-click Open in terminal.
            Alternately, you can click Menu > Applications > Accessories > Terminal.
    Step 2: Change Your Root Password.
    		In the terminal window, type the following:
            	- sudo passwd root.

Example 5: how to get root password

How to change root password in Ubuntu
The procedure to change the root user password on Ubuntu Linux:

Type the following command to become root user and issue passwd:
sudo -i
passwd
OR set a password for root user in a single go:
sudo passwd root
Test it your root password by typing the following command:
su -

Example 6: To change password in linux

#To change password in linux
#Log in to the user and Type the following command.
passwd