How to reset root and user password?

To reset the root password in LINUX

  1. Log on as root directory. This can be achieved by typing su or su root at the terminal prompt.

2. Enter the current root password. Don’t be alarmed if as you type nothing is displayed at the prompt. This is intentional for security reasons.

[e2e@localhost ~ ]: $ ssh root@ipaddress
e2e@e2e:- su
e2e@e2e:- su root

3. Type the command passwd at the root prompt.

root@e2e: # passwd
Enter NEW UNIX password:

4. Enter your new password and repeat it at the confirmation prompt.

root@e2e: # passwd
Enter NEW UNIX password:
Retype NEW UNIX password:
Password updated successfully.
  1. Logout using the exit command.

To change the user password in LINUX

Please follow the below steps:

1. Type the command passwd followed by username at the root prompt.

root@e2e: # passwd user
Enter NEW UNIX password:

Please note that user must be replaced by your user name . To know your user name, type whoami in the terminal.

2. Enter your new password and repeat it at the confirmation prompt.

root@e2e: # passwd user
Enter NEW UNIX password:
Retype NEW UNIX password:
Password updated successfully.

Hurray! Password changed successfully.