136 |
+{ |
+{ |
137 |
+ die "$user is not a user account\n" |
+ die "$user is not a user account\n" |
138 |
+ unless ( grep /^$user$/, @users ); |
+ unless ( grep /^$user$/, @users ); |
139 |
+ |
+ next if $user eq "admin"; |
140 |
+ my @dirs = ("/home/e-smith/files/samba/profiles/$user"); |
+ my @dirs = ("/home/e-smith/files/samba/profiles/$user"); |
141 |
+ |
+ |
142 |
+ foreach my $dir (@dirs) |
+ foreach my $dir (@dirs) |
143 |
+ { |
+ { |
144 |
+ my $pre_existing = ( -d $dir ); |
+ my $pre_existing = ( -d $dir ); |
145 |
+ |
+ |
146 |
+ $pre_existing || mkdir $dir, 710 || die "Couldn't create directory $dir\n"; |
+ $pre_existing || mkdir $dir, 750 || die "Couldn't create directory $dir\n"; |
147 |
+ |
+ |
148 |
+ chmod 0710, $dir; # Remove setgid bit |
+ chmod 0750, $dir; # Remove setgid bit |
149 |
+ |
+ |
150 |
+ next if $pre_existing; |
+ next if $pre_existing; |
151 |
+ chmod 0710, "/home/e-smith/files/users/$user"; |
+ system("chmod", "0750", "/home/e-smith/files/users/$user"); |
152 |
+ chmod 2770, "/home/e-smith/files/users/$user/home/public_html"; |
+ system("chmod", "2770", "/home/e-smith/files/users/$user/home/public_html"); |
153 |
+ chmod 2770, "/home/e-smith/files/users/$user/tmp"; |
+ system("chmod", "2770", "/home/e-smith/files/users/$user/tmp"); |
154 |
+ system("/bin/chown", "$user:www", "-R" , "/home/e-smith/files/users/$user/home/public_html"); |
+ system("/bin/chown", "$user:www", "-R" , "/home/e-smith/files/users/$user/home/public_html"); |
155 |
+ system("/bin/chown", "$user:www", "/home/e-smith/files/users/$user"); |
+ system("/bin/chown", "$user:www", "/home/e-smith/files/users/$user"); |
156 |
+ system("/bin/chown", "$user:www", "-R" , "/home/e-smith/files/users/$user/tmp"); |
+ system("/bin/chown", "$user:www", "-R" , "/home/e-smith/files/users/$user/tmp"); |
215 |
+ |
+ |
216 |
+die "username argument missing" unless defined ($userName); |
+die "username argument missing" unless defined ($userName); |
217 |
+ |
+ |
218 |
+ |
+return if $userName eq "admin"; |
219 |
+chmod 0710, "/home/e-smith/files/users/$userName"; |
+system("chmod", "0750", "/home/e-smith/files/users/$userName"); |
220 |
+chmod 2770, "/home/e-smith/files/users/$userName/home/public_html"; |
+system("chmod", "2770", "/home/e-smith/files/users/$userName/home/public_html"); |
221 |
+chmod 2770, "/home/e-smith/files/users/$userName/tmp"; |
+system("chmod", "2770", "/home/e-smith/files/users/$userName/tmp"); |
222 |
+system("/bin/chown", "$userName:www", "-R", "/home/e-smith/files/users/$userName/home/public_html"); |
+system("/bin/chown", "$userName:www", "-R", "/home/e-smith/files/users/$userName/home/public_html"); |
223 |
+system("/bin/chown", "$userName:www", "/home/e-smith/files/users/$userName"); |
+system("/bin/chown", "$userName:www", "/home/e-smith/files/users/$userName"); |
224 |
+system("/bin/chown", "$userName:www", "-R", "/home/e-smith/files/users/$userName/tmp"); |
+system("/bin/chown", "$userName:www", "-R", "/home/e-smith/files/users/$userName/tmp"); |
259 |
+ |
+ |
260 |
+my @users = ('admin', map { $_->key } $adb->users); |
+my @users = ('admin', map { $_->key } $adb->users); |
261 |
+ |
+ |
262 |
+my @newusers = @user; |
+my @newusers = @users; |
263 |
+#($event eq "post-upgrade") ? @users : $ARGV[1] ; |
+#($event eq "post-upgrade") ? @users : $ARGV[1] ; |
264 |
+ |
+ |
265 |
+foreach my $user ( @newusers ) |
+foreach my $user ( @newusers ) |
268 |
+ unless ( grep /^$user$/, @users ); |
+ unless ( grep /^$user$/, @users ); |
269 |
+ |
+ |
270 |
+ my @dirs = ("/home/e-smith/files/samba/profiles/$user"); |
+ my @dirs = ("/home/e-smith/files/samba/profiles/$user"); |
271 |
+ |
+ next if $user eq "admin"; |
272 |
+ foreach my $dir (@dirs) |
+ foreach my $dir (@dirs) |
273 |
+ { |
+ { |
274 |
+ my $pre_existing = ( -d $dir ); |
+ my $pre_existing = ( -d $dir ); |
275 |
+ |
+ |
276 |
+ $pre_existing || mkdir $dir, 710 || die "Couldn't create directory $dir\n"; |
+ $pre_existing || mkdir $dir, 750 || die "Couldn't create directory $dir\n"; |
277 |
+ |
+ |
278 |
+ chmod 0710, $dir; # Remove setgid bit |
+ chmod 0750, $dir; # Remove setgid bit |
279 |
+ |
+ |
280 |
+ #next if $pre_existing; |
+ #next if $pre_existing; |
281 |
+ system("mkdir -p /home/e-smith/files/users/$user/home/public_html"); |
+ system("mkdir -p /home/e-smith/files/users/$user/home/public_html"); |
282 |
+ system("mkdir -p /home/e-smith/files/users/$user/tmp"); |
+ system("mkdir -p /home/e-smith/files/users/$user/tmp"); |
283 |
+ chmod 0710, "/home/e-smith/files/users/$user"; |
+ system("chmod", "0750", "/home/e-smith/files/users/$user"); |
284 |
+ chmod 2770, "/home/e-smith/files/users/$user/home/public_html"; |
+ system("chmod", "2770", "/home/e-smith/files/users/$user/home/public_html"); |
285 |
+ chmod 2770, "/home/e-smith/files/users/$user/tmp"; |
+ system("chmod", "2770", "/home/e-smith/files/users/$user/tmp"); |
286 |
+ system("/bin/chown", "$user:www", "-R", "/home/e-smith/files/users/$user/home/public_html"); |
+ system("/bin/chown", "$user:www", "-R", "/home/e-smith/files/users/$user/home/public_html"); |
287 |
+ system("/bin/chown", "$user:www", "/home/e-smith/files/users/$user"); |
+ system("/bin/chown", "$user:www", "/home/e-smith/files/users/$user"); |
288 |
+ system("/bin/chown", "$user:www", "-R", "/home/e-smith/files/users/$user/tmp"); |
+ system("/bin/chown", "$user:www", "-R", "/home/e-smith/files/users/$user/tmp"); |
329 |
+ |
+ |
330 |
+my @users = ('admin', map { $_->key } $adb->users); |
+my @users = ('admin', map { $_->key } $adb->users); |
331 |
+ |
+ |
332 |
+my @newusers = @user; |
+my @newusers = @users; |
333 |
+#($event eq "post-upgrade") ? @users : $ARGV[1] ; |
+#($event eq "post-upgrade") ? @users : $ARGV[1] ; |
334 |
+ |
+ |
335 |
+foreach my $user ( @newusers ) |
+foreach my $user ( @newusers ) |
338 |
+ unless ( grep /^$user$/, @users ); |
+ unless ( grep /^$user$/, @users ); |
339 |
+ |
+ |
340 |
+ my @dirs = ("/home/e-smith/files/samba/profiles/$user"); |
+ my @dirs = ("/home/e-smith/files/samba/profiles/$user"); |
341 |
+ |
+ next if $user eq "admin"; |
342 |
+ foreach my $dir (@dirs) |
+ foreach my $dir (@dirs) |
343 |
+ { |
+ { |
344 |
+ my $pre_existing = ( -d $dir ); |
+ my $pre_existing = ( -d $dir ); |
349 |
+ |
+ |
350 |
+ #next if $pre_existing; |
+ #next if $pre_existing; |
351 |
+ system("/bin/chown", "$user:$user", "-R", "/home/e-smith/files/users/$user"); |
+ system("/bin/chown", "$user:$user", "-R", "/home/e-smith/files/users/$user"); |
352 |
+ |
+ system("/bin/chmod", "0700", "/home/e-smith/files/users/$user"); |
353 |
+ esmith::util::chownFile($user, $user, $dir) || |
+ esmith::util::chownFile($user, $user, $dir) || |
354 |
+ die "Couldn't change ownership of $dir\n"; |
+ die "Couldn't change ownership of $dir\n"; |
355 |
+ } |
+ } |