#!/bin/sh
#
# Author: Peter Keel <killer@discordia.ch>
# Creates homedirs for a lot of people
#
cat /dev/null > newdirs
echo "#!/bin/sh" > newdirs
cat passwd | awk -F: '
                {
                printf("mkdir %s\n", $1)
		printf("ln -sf . %s/public_html\n", $1, $1)
		printf("cp /home/httpd/templates/empty.htm %s/public_html/welcome.htm\n", $1)
		printf("chown %s %s %s/public_html %s/bin %s/public_html/welcome.htm\n", $1,$1,$1,$1,$1)
		printf("cp -r /home/ftp/bin /home/users/%s\n", $1)
                }
               ' >> newdirs
chmod 755 newdirs
newdirs
rm newdirs
