[K12OSN] HELP!! creating bulk users

Huck dhuckaby at paasda.org
Fri Aug 24 00:35:53 UTC 2007


ahhh you need one of those lovely 'awk/sed' scripts that Les pimps out..

that parses your /etc/passwd file and strips out the username and group 
and does a
mkdir -p /home/<username>
then does a
chown -R <username>:<group>
then does a
chmod 700 /home/*

if only scripting were as easy as english!

--Huck
p.s. maybe this old gem I have tucked away in my archives will be of 
assistance...

[quote]

Assuming all teacher names end in two digits and none of the students
account names do this one liner may work:

for teach in `cat /etc/passwd | awk '{FS=":";}{print $1}' | \
egrep "[0-9][0-9]" ` ; do dir=/var/www/html/${teach}; mkdir $dir;\
chmod 775 $dir ; cd /home/${teach}; ln -s $dir ${teach}.html; done

not tested or debugged, use at own risk, beware of gnats etc..
[/quote]




More information about the K12OSN mailing list