How To Disable a User In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Open the terminal and log in as a root user.
2. Use the command usermod -L username to lock the user account.
3. Use the command usermod -e 1 username to set an expiry date for the user account.
4. To completely disable the user account, use the command usermod -f 0 username.
5. To delete the user account, use the command userdel -r username.
6. To confirm the changes, use the command cat /etc/shadow to view the changes made to the user accounts.