Under Linux, all actions that you can carry out with the mouse and window system via the graphical user interface can also be performed using program calls in the terminal – provided you know the appropriate command and how to use it according to the correct syntax. To make working in the terminal easier, we provide you with an overview of basic Linux commands with detailed descriptions and...All important Linux commands
How to change a Linux password
To best manage your own user account or the accounts of other users, it is helpful to know the most important utilities of Linux. This includes passwd, which you can use to change your Linux password, among other things. You can learn the individual steps here.
The passwd command in Ubuntu
The passwd program package, which allows you to easily change your own password or the passwords of an entire group, as well as set other commands, is included in most Linux installations. Our guide refers to the Ubuntu installations - Ubuntu is one of the most versatile, free distributions of Linux with long-term support and biannual updates.
If you are not sure which Linux distribution or version you are using, see our article on how to display your Linux version.
Change your own Linux password
If you want to change your own Linux password, this is a relatively straightforward process.
- Open the Linux terminal. This is where you normally enter commands.
- Now type the command “passwd”. This is how you tell the system that you want to change your Linux password.
- Depending on the version, you may be prompted to enter your old password. In response, simply enter your new password and confirm it again.
- If you now try to log into the system, the new password will be valid.
$ passwd Enter a new UNIX password: Re-enter the new UNIX password: passwd: Password successfully changed $
Changing passwords regularly was once one of the top recommendations for keeping safe online. However, this long-standing advice has been withdrawn, as changing passwords frequently can weaken security. Therefore, it is advisable to only change a password if the password is considered “compromised” or too weak.
Change a Linux password for one user
If you want to change the password of another user, then you need the root privileges. This means that you are the only user of the computer who has unlimited rights to all system files and resources. Keep your password ready for this reason.
- To change a user password, access the terminal and type “sudo passwd <username>”.
- Follow the steps in the previous example: enter new password and confirm by typing it again.
- If the password is set, the respective user must use the new password at the next login.
$ sudo passwd username Enter a new UNIX password: Re-enter the new UNIX password: passwd: Password successfully changed $
Force Linux password change at next log in
Sometimes a system administrator needs a user to change their password immediately. This can be for various reasons. There may be a user change for an account, or a password may have fallen into the wrong hands. In this case, enter the following syntax as an administrator: “-e passwd <username>”. Here, “-e” stands for “expire” and causes the respective password to expire immediately, so that the affected user must set up a new password the next time they log in.
We have collected the most important Linux commands for you in our article.