Linux Command details chpasswd batch change user passwords

Source: Internet
Author: User

Linux Command details chpasswd batch change user passwords
Command: chpasswd
Batch change user passwords

Working principle:
Read the user name and password from the standard input of the system, and use this information to update the existing user password on the system.

Syntax:
1: # echo Username: Password | chpasswd
2: # chpasswd <doiido.txt

Parameters:
-E: If the-e option is used, the password can only be passed in encrypted mode.
If the-e option is not used, the password will be passed in plaintext

Notes
1: The user name must be an existing user on the system.
2: normal users do not have permission to use this command
3: If the input file is transmitted in non-encrypted mode, encrypt the file properly.
4: The command file cannot be empty.

Instance
1. directly change the doiido user password to helloboy.
# Echo doiido: helloboy | chpasswd

2XX use the username and password in doiido.txt to modify the passwords of corresponding users in batches
2.1: first set up the instruction file doiido.txt (Format: [username: passwd])
# Vi doiido.txt
Doiido1: helloboy
Doiido2: hellogirl

2.2: transfer the content of doiido.txt to the chpasswd command to modify the password of the user.
# Chpasswd <doiido.txt

3. Let common users use chpasswd
By default, normal users do not have the chpasswd permission, but you can modify it by modifying the command file permission.
# Chmod 4755/usr/sbin/chpasswd

In this way, common users can use chpasswd to change their passwords.



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.