simple mass user edquota script

Categories: Script

i was in a crunch. so i put together this little hack script to run every night to ensure that user quotas were being set for all users:

NAMES=`ls -l <change this to user home> | awk '!/total/ {print $3}'`
for NAMES in $NAMES; do
    edquota -p <change this to protoname> $NAMES
  • Correction: The variable NAMES immediately after key word for should be NAME, and so is the one on the edquota command line.

    That is

    for NAME in $NAMES; do
    edquota -p $NAME

  • The text formatting messed up my comments. There should be change_this_to_protoname in that edquota command line.

  • ls -1 /home | xargs -I ‘{}’ edquota -p $templateuser ‘{}’

    This will give errors of course, since this will also try to apply quota on the template user and the quotafiles themselves.
    So better do

    ls -1 /home > users.txt

    then edit the unnescessary lines out users.txt

    cat users.txt | xargs -I ‘{}’ edquota -p $templateuser ‘{}’

Leave a Reply

Your email address will not be published. Required fields are marked *