How to disable a user account in Linux

Source: Internet
Author: User
In Linux, how to disable a user account-general Linux technology-Linux technology and application information is as follows. In Linux, use/etc/shadow to save the encrypted user password. The fastest way to disable an account is to modify the password stored in/etc/shadow, A valid Linux User usually has the following line in/etc/shadow:

User: $1 $ eFd7EIOg $ eeck6xgktwsugi2pgupk.: 13852: 0: 99999: 7 :::

Each field is separated by a colon. The second field is the user password information. If we change the second value to an asterisk * or an exclamation point! This account is disabled and users cannot use this account to log on to the system:

User: *: 13852: 0: 99999: 7 :::

Here I will introduce a simpler method:

Sudo passwd-l User Name

Disable this account. View/etc/shadow and you will find that a exclamation point is added before the password.

Re-enable this account using the following command:

Sudo passwd-u User Name
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.