Like my .mozilla setup that I had to change for all my users or update to all 
their .bashrc's

Which I had to to recently for all users.  

The perl script below (run as sudo) re-copies the contents of /etc/skel to each 
user's folder.
In particular, it copies .mozilla with all the correct Firefox settings, locks, 
etc.  Then sets
correct permissions.

Also, it gets all the folders to copy to from /etc/passwd but  ignores users 
with id's below 1002, which for me includes me and my co-admin, and all the 
system accounts.

Saved me a lot of work.  Can be easily modified to copy pretty much anything.  
Or not copy anything, just 
generate a quick user list.

You probably would have to install File::Copy::Recursive
from terminal:

sudo cpan
.....(hit enter bunch of times)
install File::Copy::Recursive


***************************************************reskel.pl**********************************************
#!/usr/bin/perl -w

use strict;
use File::Copy::Recursive qw(dircopy);
 
my $fromdir = qw (/etc/skel);

open (MYFILE, "/etc/passwd") || die "Problem reading file $!";   
        my @contents=<MYFILE>;
close (MYFILE);
 
foreach my $user(@contents){
        my @users=split(/:/, $user);
        my ($username, $password,$uid, $gid,$gecos, $home, $shell)=...@users;
        
        if ($uid > 1001 && -d $home){
                print system("mv $home/.mozilla $home/.mozillaold");
                system ("rm -r $home/.mozillaold");
                print " Copying UserID $uid Group ID $gid to $home. \n";
                dircopy($fromdir, $home) or die("$!\n");
                system("chown -R $uid:$gid  $home");
                system ("rm -r $home/.mozillaold");
        }
}

-- 
edubuntu-users mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/edubuntu-users

Reply via email to