simple mass user edquota 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:

#!/bin/bash
NAMES=`ls -l <change this to user home> | awk '!/total/ {print $3}'`
for NAMES in $NAMES; do
    edquota -p <change this to protoname> $NAMES
done
«
»
  • 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
    done

  • 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
    and

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


Leave a Reply

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