[Email protected] wyb]#CatUser10.SH #!/bin/bash# Batch creation of 10 system accounts wangyb01-WANGYB10 and set the password (the password is a random 8-bit string). >user.list forUserinch`seq-W Ten` Douseradd wangyb$user Password=`Echo$RANDOM |md5sum|Cut-C1-8` Echo$password |passwdWangyb$user--stdinEchoWangyb$user $password >>user.list Done[email protected] wyb]# bash user10.SHCreating Mailboxfile: File existsuseradd:warning:the home directory already exists. Not copying anyfileFrom Skel directory to it. changing password foruser wangyb01.passwd: All authentication tokens updated successfully. Creating Mailboxfile: File existsuseradd:warning:the home directory already exists. Not copying anyfileFrom Skel directory to it. changing password foruser wangyb02.passwd: All authentication tokens updated successfully. Creating Mailboxfile: File existsuseradd:warning:the home directory already exists. Not copying anyfileFrom Skel directory to it. changing password foruser wangyb03.passwd: All authentication tokens updated successfully. Creating Mailboxfile: File existsuseradd:warning:the home directory already exists. Not copying anyfileFrom Skel directory to it. changing password foruser wangyb04.passwd: All authentication tokens updated successfully. Creating Mailboxfile: File existsuseradd:warning:the home directory already exists. Not copying anyfileFrom Skel directory to it. changing password foruser wangyb05.passwd: All authentication tokens updated successfully. Creating Mailboxfile: File existsuseradd:warning:the home directory already exists. Not copying anyfileFrom Skel directory to it. changing password foruser wangyb06.passwd: All authentication tokens updated successfully. Creating Mailboxfile: File existsuseradd:warning:the home directory already exists. Not copying anyfileFrom Skel directory to it. changing password foruser wangyb07.passwd: All authentication tokens updated successfully. Creating Mailboxfile: File existsuseradd:warning:the home directory already exists. Not copying anyfileFrom Skel directory to it. changing password foruser wangyb08.passwd: All authentication tokens updated successfully. Creating Mailboxfile: File existsuseradd:warning:the home directory already exists. Not copying anyfileFrom Skel directory to it. changing password foruser wangyb09.passwd: All authentication tokens updated successfully. Creating Mailboxfile: File existsuseradd:warning:the home directory already exists. Not copying anyfileFrom Skel directory to it. changing password foruser Wangyb10.passwd: All authentication tokens updated successfully. [Email protected] wyb]#Catuser.list wangyb01 77950e07wangyb02 ace3cfb1wangyb03 2cd63081wangyb04 0f891e3cwangyb05 600bedd4wangyb06 73d3dfdcwangyb0730740006wangyb08 54cf685fwangyb09 ee3f88afwangyb10 b54d2555[[email protected] wyb]#suwang01su: User wang01 does not exist[[email protected] wyb]#suWangyb01[[email protected] wyb]$suWangyb10password: [[email protected] wyb]$ [[email protected] wyb]#CatDeluser10.SH #!/bin/bash# Delete 10 system accounts in bulk WANGYB01-WANGYB10 and set the password (the password is a random 8-bit string). >user.list forUserinch`seq-W Ten` DoUserdel Wangyb$user Done[email protected] wyb]# bash deluser10.SH[email protected] wyb]#suWANGYB01su: User wangyb01 does not exist[[email protected] wyb]#
Shell script, create 10 system accounts in bulk and set the password to a random 8-bit string.