How to Change a User Password in Linux
The importance of passwords and the role it plays in our digital life cannot be emphasized enough. Passwords are probably our first line of defense when it comes to securing digital content.
Linux is by nature a multi-user operating system, meaning that you can share a Linux machine with other users. This is especially true for shared servers in the cloud. Without a solid password, unauthorized users may easily gain access to your content.
Fortunately, Linux is a robust and secure platform. And it offers a simple and intuitive way of managing user passwords from the command terminal.
A regular user can only change the password for their own account, while a superuser can change the password of any user account on the Linux system.
Changing your own password
The command for changing user passwords in Linux is
passwd. To change your own password simply open the command terminal and type the following command.
You will then be prompted to enter your old password followed by the new user password as in the figure below.
Note: You will not see anything as you fill in your passwords. This is the Unix way of protecting you from shoulder surfers.
Changing the root password
The root user in Linux is what the Lion is to the Jungle: King. The root user has privileges to modify anything on the Linux system.
You can change the root user password as follows. Then you will be prompted to enter the new password.
$ sudo passwd root
Alternatively, you can change the root user password as follows.
First, switch to be the root user by typing the following command. You will then be prompted to enter the root user password. Once
Once you are logged in as the root user you can then change the password by typing the command below.
Note: When you are logged in as the root user, the # symbol is used in the prompt.
Make sure to exit out of the root user prompt when you are done running your command. To exit the root user prompt simply type.
Changing passwords for regular users
The majority of users on Linux are non-root users. You will need to have administrative privileges to change the password of other users on a Linux system. The command for changing other user’s passwords is
passwd username. For example, to change the passwd for user Linga on a system. Simply run.
$ sudo passwd linga
You will then be prompted to type in the new user password.
The beauty of Linux is that you can learn more about commands right from within the terminal. To learn more about the
passwd command, please use the man pages as follows.
As mentioned earlier, passwords are your first line of defense in the digital world. Use secure passwords and do not use the same password on different platforms.
Consider using a password manager to help you in creating and remembering your secure passwords.