#!/usr/bin/perl # reads in a tab delminted file for adding users. # Use with the shell-tool version 1.1-2 and greater # Written by: Jeff Bilicki use strict; # Setup for file input my $error_file = "Usage: $0 \n"; my $error_help = "Usage: $0 --help\n"; # The site_name will be the full site name where the user are added my $site_name = "www.changeme.com"; # Other variables read in from the file my $arg; if (@ARGV) { $arg = $ARGV[0]; if ($arg eq "--help"){ print $error_file; die "The file should be your import file\n"; } else { open(PASSIT, $arg) or die "Cannot open file $arg: $!\n"; } } else { die $error_file, $error_help; } while (my $line = ) { chomp($line); my ($username,$fullname,$passwd) = split("\t", $line); print "Adding $username:$fullname:$passwd\n"; system("/usr/sbin/cadduser -d $site_name -u $username -f \"$fullname\" -p $passwd"); } close(PASSIT); exit 0;