批量添加用戶,並且第一次登陸需要輸入密碼

if [ ! -f account.txt ]; then
    echo "The file do not exist!"
    exit 1
fi

username=$(cat account.txt)

for username in $username
do
    useradd $username
    echo $username | passwd --stdin $username
    chage -d 0 $username
done

用戶列表在account.txt文件裏

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章