您好,登錄后才能下訂單哦!
批量創建用戶并設置密碼不為相同
#!/bin/bash for n in `seq -w 10` do useradd xcn$n&&\ echo "root$n"|passwd --stdin xcn$n done 執行結果: [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.
批量創建用戶并設置密碼為隨機
方法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
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。