Wednesday, May 18, 2016

Ubuntu - List Users and reset password for a user

How to list all users in Ubuntu?

cut -d: -f1 /etc/passwd

How to reset a specific accounts password in ubuntu?

1. During the boot process either click "Shift" key or mouse "Left Click" until you see the below screen

2. Now select the option "Ubuntu with Recovery Mode" (2nd option)

3. You should see the screen as below

4. Now select the option "root - Drop to root shell prompt" and you should see something like below


5. Now at this level we will just have a read only file system so please execute the below command

mount -rw -o remount /

6. Once the above command is done just run the below commands

root@ubuntu:~# passwd <<username that you wish to change the password for>>
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

NOTE: In the above command replace the placeholder with the username you wish to change the password for