[K12OSN] OT: Help with Template User Script

James P. Kinney III jkinney at localnetsolutions.com
Mon Nov 26 22:26:19 UTC 2007


On Mon, 2007-11-26 at 11:59 -1000, 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

Are the goofs "all perms not reset" or "some perms reset" or "unknown"?

Also, is a space allowed in a group name? The chown line has a
backslashed space in "Domain Users". I thinks that's a no-no but I can't
pull a reference for it.

There is a script in K12LTSP (in /opt/k12ltsp/templates) that is used to
reset user . files back to a sane pattern based on what's in /etc/skel.
That process explicitly names .gnome, .kde, etc directories.
> 
> 
> 
> #!/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>
> 
-- 
James P. Kinney III          
CEO & Director of Engineering 
Local Net Solutions,LLC        
770-493-8244                    
http://www.localnetsolutions.com

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
<jkinney at localnetsolutions.com>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/k12osn/attachments/20071126/b55e2040/attachment.sig>


More information about the K12OSN mailing list