How to lock a user account?

The passwd command can be used to create passwords. Another option is to use the tool to lock or unlock a user account. The ability to lock users can be useful to prevent usage of the account while not directly deleting it. This might come in handy when a colleague or employee left the company.

Examples

chage -E0 account

Mark account as expired, so that also SSH users no longer can use the account.


passwd -l account

This command will lock the specified account. The root user can unlock accounts when required.


Recently updated at May 21, 2023

Do you like this page? Share it with others or help us make it better

Yes!

Share with friends:
Share on Twitter