To disable a user account on Linux, you can use the usermod
command. The usermod
command allows you to modify the attributes of a user account. To disable a user account, you can add the -L
option to the usermod
command.
For example, to disable the user account named user1
, you would run the following command:
usermod -L user1
This will lock the user account, preventing the user from logging in. To re-enable the user account, use the -U
option:
usermod -U user1
Note: Depending on your Linux distribution, the usermod
command may require root privileges. You can run the command with sudo
if necessary.