How to Set or Change User Password in Linux
Table of Contents
Set or Change User Password in Linux
In this tutorial you are going to learn how to change password in Linux. You will also learn how to set password using
privileges of another user as the root account in Linux has highest priority over all other accounts.
Before you start to install Yarn on Ubuntu 18.04. You must have the non-root user account on your system with sudo privileges.
Change your own password
Now to change your own password run following command in the terminal:
Now you will be asked to enter your current password. After success you will be asked to enter new password and confirm it.
Changing password for Linux4one. (current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully.
Change another users password
As mentioned above to change password of another user you should use
sudo privileges. Following is the basic syntax to change password of another user.
sudo passwd [username]
Now to change password of user
john you should run following command.
sudo passwd john
Here you will be asked to enter new password and confirm it.
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
Force user to change password
If you want to make user to change password on his next login you should add
passwd command as given below. It will instantly expire user password and will ask him to change it on login.
sudo passwd --expiry john
On user login he will prompted as below:
WARNING: Your password has expired. You must change your password now and login again! Changing password for linuxize. (current) UNIX password: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Connection to 192.168.43.106 closed.
On setting new password connection will be closed.
Change Group Password
To change group password we should use
-g option with
passwd command. To change password of group
developers run following command.
sudo passwd -g developers
You have successfully learned how to set or change user password in Linux. If you have any queries regarding this then please don’t forget to comment below.
How to Install WebStorm on Debian 9
How to Install Eclipse IDE on Linux Mint 19
How to install Krita on Ubuntu 18.04
How to Install RubyMine on Ubuntu 18.04
Bash Functions with Examples
How to Remove Docker Images, Networks, Containers and Volumes
How to install PHP 7.2 on CentOS 7
How to Install Yarn on Linux Mint 10
How to Install IntelliJ IDEA IDE on Debian 9
Linux useradd Command with Examples
How to Install WebStorm on Linux Mint 19
How to Search Multiple Words or String Patterns Using grep Command