Bulk create 10 oldboy01-oldboy10 system accounts and set a password, the password is a random string of 8
#!/bin/bash for user in oldboy{01..10} do useradd $user echo `date "+%N" | md5sum | tr -d [0-9] | head -c 8` | passwd --stdin $user sleep 1 done
10 bulk delete system accounts oldboy01-oldboy10
#!/bin/bash for user in oldboy{01..10} do userdel -r $user done
Add users in a given user name, and modify it in accordance with the given password
#! / bin / bash # own user file can be created manually, automatically generated here with my command echo "" > / SRV / Script / username sed -i ' 1i \ devops1 \ devops2 \ devepment1 \ devepment2 ' / SRV / Script / username sed -i ' / ^ $ / d ' / SRV / Script / username # I now manually generate the password file cp -a / SRV / Script / username / SRV / Script / passwd sed -i ' 1, $ S /.* / &: & / ' / SRV / Script / passwd # batch create user for the user in $ ( CAT / SRV / Script /username) do the useradd $ User DONE # Change Password command the chpasswd </ SRV / Script / the passwd
chpasswd batch modify user password
Read input user's name and password from the standard system, and use this information to update the user's presence on the system password
format
echo Username: Password | chpasswd chpasswd <doiido.txt
parameter
-e: If the -e option, the password will only be passed in encrypted form, if the -e option is not used, the password will be passed as plaintext
Delete user accounts in accordance with the given user name
for user in $(cat /srv/script/username); do userdel -r $user done