您好,登錄后才能下訂單哦!
批量創(chuàng)建用戶并設(shè)置密碼不為相同
#!/bin/bash for n in `seq -w 10` do useradd xcn$n&&\ echo "root$n"|passwd --stdin xcn$n done 執(zhí)行結(jié)果: [root@XCN for]# sh test7.sh Changing password for user xcn01. passwd: all authentication tokens updated successfully. Changing password for user xcn02. passwd: all authentication tokens updated successfully. Changing password for user xcn03. passwd: all authentication tokens updated successfully. Changing password for user xcn04. passwd: all authentication tokens updated successfully. Changing password for user xcn05. passwd: all authentication tokens updated successfully. Changing password for user xcn06. passwd: all authentication tokens updated successfully. Changing password for user xcn07. passwd: all authentication tokens updated successfully. Changing password for user xcn08. passwd: all authentication tokens updated successfully. Changing password for user xcn09. passwd: all authentication tokens updated successfully. Changing password for user xcn10. passwd: all authentication tokens updated successfully.
批量創(chuàng)建用戶并設(shè)置密碼為隨機
方法1:
#!/bin/bash for n in `seq -w 10` do pass=`echo "$RANDOM"|md5sum|cut -c 1-8` useradd xcn$n&&\ echo "$pass" |passwd --stdin xcn$n echo -e "xcn$n\t $pass" >>/data/pass.log done
批量刪除用戶
#!/bin/bash for n in `seq 10` do userdel -r xcn$n &&\ done
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。