--- loncom/Attic/lcuseradd	2001/11/15 19:08:00	1.16
+++ loncom/Attic/lcuseradd	2001/11/15 22:38:12	1.17
@@ -10,7 +10,7 @@
 # YEAR=2001
 # 10/21,11/13,11/15 Scott Harrison
 #
-# $Id: lcuseradd,v 1.16 2001/11/15 19:08:00 harris41 Exp $
+# $Id: lcuseradd,v 1.17 2001/11/15 22:38:12 harris41 Exp $
 ###
 
 ###############################################################################
@@ -199,7 +199,12 @@ if (system('/usr/sbin/useradd','-c','LON
 }
 
 # Make www a member of that user group.
-if (system('/usr/sbin/usermod','-G',$safeusername,'www')) {
+my $groups=`/usr/bin/groups www` or exit(6);
+chomp $groups; $groups=~s/^\S+\s+\:\s+//;
+my @grouplist=split(/\s+/,$groups);
+my @ugrouplist=grep {!/www|$safeusername/} @grouplist;
+my $gl=join(',',(@ugrouplist,$safeusername));
+if (system('/usr/sbin/usermod','-G',$gl,'www')) {
     print "Error. Could not make www a member of the group ".
 	  "\"$safeusername\".\n" unless $noprint;
     unlink('/tmp/lock_lcpasswd');
@@ -231,7 +236,8 @@ if ($?) {
 
 # system('/bin/chmod','-R','0660',"/home/$safeusername");
 system('/bin/chmod','0710',"/home/$safeusername");
-mkdir "/home/$safeusername/public_html",2760;
+mkdir "/home/$safeusername/public_html",0755;
+system('/bin/chmod','2770',"/home/$safeusername/public_html");
 open OUT,">/home/$safeusername/public_html/index.html";
 print OUT<<END;
 <html>
@@ -250,9 +256,9 @@ This area provides for:
 <li>resource construction</li>
 <li>resource publication</li>
 <li>record-keeping</li>
-</UL>
-</BODY>
-</HTML>
+</ul>
+</body>
+</html>
 END
 close OUT;
 system('/bin/chown','-R',"$safeusername:$safeusername","/home/$safeusername");