Virtual machines: VMware virtual machines
System: Linux ubuntu 4.4.0-31-generic #50 ~14.04.1-ubuntu SMP Wed Jul 01:07:32 UTC x86_64 x86_64 x86_64 gnu/linux
See "bird Brother's private food-server set up" when, with the book to hit the command when encountered a problem, batch add users and modify password failed.
The shell command is as follows:
The following error occurred while running the script with SH:
Both the measured user and the user group have been added successfully, but there was an error in bulk modifying the password and could not be passed.
Find the data to understand that the bulk of the creation of users in general will use the Passwd–stdin parameters, in Debian/ubuntu without this parameter, and I am using the Ubuntu system. The word Ubuntu thinks that using this parameter to bulk change password is not safe, so it is not added to the instruction.
is not in the Ubuntu system can not be batch modification properties, obviously do the system when the problem does not occur.
By looking up I found a directive that would be a good solution to this problem (without regard to security)----"CHPASSWD"
CHPASSWD is a batch update user password command that reads the paired user name and password from the standard input in bulk and uses that information to update an existing set of users in the format--username:password
The middle is separated by a colon, and no spaces appear. Specific syntax operations, you can view the system's internal instructions through man, here only to do simple application.
After knowing the instructions, I made a simple change to the script:
Small do test:
The user is created successfully and can then log on with a password.
Note: User creation, script writing is under the root user operation, the general user if the operation may involve permissions issues;
This method modifies the password security is not very good, only suitable for individual learning to use;
Linux contact is not deep, may not understand the instructions thoroughly, such as errors and unreasonable places to welcome correct.
Linux '--stdin ' ERROR-Bulk Change password