[K12OSN] OT: Help with Template User Script

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


On Mon, 2007-11-26 at 14:24 -0800, Huck wrote:
> 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.

True, but at this point the ls is just used to get a list of all user
home dirs so . files are not an issue.

I tend to be a bit more specific (I may have goofed up and blown away
the default separator $IFS) so I use 'ls -1' (that's a number one) to
force the output to be single column.
> 
> --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>
> > 
> > 
> 
> _______________________________________________
> 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/72c98d27/attachment.sig>


More information about the K12OSN mailing list