2008
10.16

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

4 comments so far

Add Your Comment
  1. 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 ‘{}’

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

  3. for NAME in $NAMES; do
    edquota -p $NAME
    done

  4. 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