#!/bin/sh # # addpoolusers - create pool of users for gridmapdir mechanism and # populate gridmapdir # # http://www.hep.grid.ac.uk/gridmapdir/ # # Andrew McNab March 2001 # startUID=2000 # start UID of first user endUID=2005 # UID of last user - no more than startUID+999 group=users # group to assign all pool users to prefix=gpool # prefix, eg gpool000, gpool001, ... homedirs=/home/gpool # where to make the home directories ########## You dont need to edit anything below this line ######### ########## but you should make sure you understand it before ######### ########## running this script on your system !!!!!!!!!!!!!! ######### counter=0 while [ $startUID -le $endUID ] do username="$prefix`printf '%03d' $counter`" # ie 0-999 pool users ^^^^ homedir="$homedirs/$username" if [ -d $homedir ] ; then echo $homedir exists already. Skiping $username else /usr/sbin/useradd -g $group -n -M -u $startUID -d $homedir $username mkdir $homedir chown $username.$group $homedir chmod 0700 $homedir echo Created user $username, UID=$startUID fi if [ ! -d /etc/grid-security/gridmapdir ] ; then : # no gridmapdir on this machine elif [ -f /etc/grid-security/gridmapdir/$username ] ; then echo $username already listed in /etc/grid-security/gridmapdir else touch /etc/grid-security/gridmapdir/$username echo $username added to /etc/grid-security/gridmapdir fi echo counter=`expr $counter + 1` startUID=`expr $startUID + 1` done