How to Lock and Unlock User Account in Linux
To lock or unlock a user account, use the following commands:
To lock the account:
passwd -l user2
The password for the user “user2” is now locked, preventing login.
To unlock the account:
passwd -u user2
The password for the user “user2” is now unlocked, allowing login again.
How to Change User Password in Linux | passwd Command
Securing user accounts is a fundamental aspect of maintaining a robust and secure Linux system. One essential task is changing user passwords regularly to prevent unauthorized access. The passwd
command in Linux provides a straightforward and effective way to modify user passwords. This article will guide you through the process of changing user passwords using the passwd
command, offering insights into its various options and best practices.
Table of Content
- Understanding the `passwd` Command
- Basic Syntax of `passwd` in Linux
- Options Available in `passwd` Command in Linux
- 1. How to Change User Password in Linux
- 2. How to Change Another User’s Password in Linux
- 3. How to Change the User Password Forcely
- 4. How to Lock and Unlock User Account in Linux
- 5. How to Set Password Expiry
- Processing in passwd command: