To lock or disable a user account on a system with Linux operating system, you can edit and write the following command according to your needs.
sudo passwd -l [user_name]
For example, if you want to lock the Ubuntu user account:
sudo passwd -l ubuntu
You can customize and use the following command to specify the expiration date and lock it automatically.
sudo passwd -e YYYY-MM-DD [user_name]
For example, to lock the Ubuntu user account on 05.10.2020;
sudo passwd -e 2020-10-05 ubuntu
Note: To reactivate a disabled user, you can edit and write the command as follows.
sudo passwd -u [username]
For example, we can use the following command to activate the Ubuntu user.
sudo passwd -u ubuntu
You have examined the knowledge base in detail, but if you cannot find the information you need,
Create a Support Ticket