Can I set a temporary lock?

QuestionsQuestions8 SkillsProUser Account ManagementSep, 20 2025
0133

Yes, you can set a temporary lock on a user account by using the chage command to specify an expiration date for the account. This will effectively lock the account after the specified date. Here’s how to do it:

  1. Open a terminal.

  2. Run the following command, replacing username with the actual username and YYYY-MM-DD with the desired expiration date:

    sudo chage -E YYYY-MM-DD username

For example, to lock the account on December 31, 2023, you would use:

sudo chage -E 2023-12-31 username

After the specified date, the user will not be able to log in until the expiration is removed or changed.

To check the current expiration date for a user account, you can use:

sudo chage -l username

If you want to remove the expiration date and unlock the account, you can set it to never expire with:

sudo chage -E -1 username

This will allow the user to log in without any restrictions.

0 Comments

no data
Be the first to share your comment!