歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

批量創建用戶和磁盤配額的腳本

#!/bin/bash 
     
#create users and quota for /home patition 
#批量創建用戶並分配磁盤配額 
#2012-10-15 v1 
#http://www.bianceng.cn
     
if [ ! $(grep quotagrp /etc/group) ];then 
        groupadd quotagrp 
        echo "quotagrp created."
else
        echo "quotagrp exist."
fi 
     
declare -i n; 
     
for((n=6;n<=10;n=$n+1)) 
do
        useradd -g quotagrp user$n 
        echo "user$n" | passwd --stdin user$n 
        setquota -u user$n 50000 60000 0 0 /home 
done
Copyright © Linux教程網 All Rights Reserved