[K12OSN] OT: Help with Template User Script
Huck
dhuckaby at paasda.org
Mon Nov 26 22:24:32 UTC 2007
for USER in 'ls' I presume just uses the generic 'ls' command...
you might need the '-a' flag to ensure it SEES 'all'
directories/files...including the hidden ones.
--huck
R. Scott Belford wrote:
> 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
>
> _______________________________________________
> K12OSN mailing list
> K12OSN at redhat.com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>
>
>
More information about the K12OSN
mailing list