[K12OSN] OT: Help with Template User Script

R. Scott Belford scott at hosef.org
Mon Nov 26 21:59:17 UTC 2007


In the interest of being able to make a template user whose settings can 
be extracted to existing users, we have come up with a few scripts. 
Things appear to work, however, the teacher reports that a some users' 
permissions are not reset properly.  I wonder if any of you could advise 
if this is a script syntax issue, or if we should be looking elsewhere 
for the answer.  If nothing else, perhaps this is helpful for some 
looking to do something similar.

respect

--scott



#!/bin/bash

#Make template user, tar, extract, change permissions

# settings
BASE_HOME_DIR=/home/students
TEMPLATE_FILE=/home/students/template/template.tar.gz
BASE_TEMPLATE_DIR=/home/students/template

cd ${BASE_TEMPLATE_DIR}

tar -cvzf template.tar.gz * .[a-zA-Z0-9]*

cd ${BASE_HOME_DIR}
for USER in `ls`
do
     echo 'Extracting for user:' ${USER}
     cd ${BASE_HOME_DIR}/${USER}
     tar -zxvf ${TEMPLATE_FILE}
     chown -fR ${USER}:Domain\ Users * .[^.]*
done


and, because I have not conveniently determined a way to update 
permissions and ownerships of hidden files within the user's directory 
as well as well as of the users' directories themselves, I run this next


#!/bin/bash

# change permissions of users' directories

# settings
BASE_HOME_DIR=/home/students

cd ${BASE_HOME_DIR}
for USER in `ls`
do
     chown ${USER}:Domain\ Users ${USER}
done




More information about the K12OSN mailing list