How To Change User’s Password Through Terminal In Linux/Unix?

How To Change User’s Password Through Terminal In Linux/Unix?

   

Linux or Unix is the multi-user operating system that means more than one user can use system resources simultaneously. In order to use the system resources, users are required to login to their respective user accounts.

To prevent unauthorized user access these accounts can be protected with a password. So anyone who wants to access the system resources needs a user account and password.

In this article, we will discuss to set or change the password of a user account by using a terminal.

Change the password of the current user

In the Linux password of user accounts are stored in /etc/shadow file in encrypted form. The passwd command is used to change or set the password of a user account.

Now to change the password of the current user, use the following command in your terminal-

passwd

Once you execute this command it will ask you to enter the current password, enter it. In the next lines, it will ask you to enter a new password and retype it. Now if password matches then your password will be updated successfully.

Change the password of another user

You can change the password of another user by logging into your account using the following command –

sudo passwd user_name

For example –

sudo passwd vaibhav

Once this command gets executed you will be asked to enter the new password and retype it in the next line. If the password you enter matches then you will get a message that password updated successfully.

How to change the password of the root user

To change the password of the root user, use the following command in your terminal-

sudo passwd root

or first, log in to root account and then enter the following command –

passwd

And then provide whatever information it ask to enter.

Conclusion

Now I hope the information provided here is useful to you. If you have any questions regarding this topic you can write to us in the comments below.

Previous Data centre automation for HPC
Next How To Mount And Unmount File Systems From The Linux Terminal?

About author

You might also like

Uncategorized 0 Comments

How To Disable Secure Boot In A System?

Secure boot is a feature of UEFI which ensures that your PC boots only through the firmware that is trusted by the manufacturer. You can disable it through the UEFI

Uncategorized 0 Comments

How To Open A Directory with Root Privileges In Ubuntu 20.04 LTS?

In Linux or Unix, you can perform almost any task by using a terminal. You need to have superuser privileges to perform tasks such as installation or removal of softwares,

Uncategorized 0 Comments

How To Install Or Remove Packages Using Ports Collection In FreeBSD?

FreeBSD provides various tools as a part of its base system. In FreeBSD, there are two ways to install software packages from official repositories or third-party sources i.e. pkg and

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply