How to enable and disable Linux accounts

Source: Internet
Author: User

Three methods to temporarily disable a normal account to log on to Linux

1. Modify the password column in/etc/shadow and add an exclamation point (!), With! No! Enabled
2. Use the usermod command (enable usermod-L and enable usermod-U)
3. Use the passwd command (passowd-l disabled, passwd-u enabled)

Example:

You have created an account named Nick. Please note that! Disappear?

Method 1:
[Root @ localhost Home] # grep Nick/etc/shadow
NICK :! $1 $ uqlz3mcp $ r9nmid79ckgxpzupg2wgf.: 14873: 0: 99999: 7 :::

Method 2:
[Root @ localhost Home] # usermod-l nick
[Root @ localhost Home] # grep Nick/etc/shadow
NICK :! $1 $ uqlz3mcp $ r9nmid79ckgxpzupg2wgf.: 14873: 0: 99999: 7 :::
[Root @ localhost Home] # usermod-u Nick
[Root @ localhost Home] # grep Nick/etc/shadow
NICK: $1 $ uqlz3mcp $ r9nmid79ckgxpzupg2wgf.: 14873: 0: 99999: 7 :::

Method 3:
[Root @ localhost Home] # passwd-l nick
Locking password for user Nick.
Passwd: Success
[Root @ localhost Home] # grep Nick/etc/shadow
NICK :!! $1 $ uqlz3mcp $ r9nmid79ckgxpzupg2wgf.: 14873: 0: 99999: 7 :::
[Root @ localhost Home] # passwd-u Nick
Unlocking password for user Nick.
Passwd: success.
[Root @ localhost Home] # grep Nick/etc/shadow
NICK: $1 $ uqlz3mcp $ r9nmid79ckgxpzupg2wgf.: 14873: 0: 99999: 7 :::

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.