#!/usr/local/bin/perl # # $Header: provisionAddUsr.pl 19-sep-2005.08:10:54 adeb Exp $ # # provisionAddUsr.pl # # Copyright (c) 2005, Oracle. All rights reserved. # # NAME # provisionAddUsr.pl - # # DESCRIPTION # Script to create a user account: encrypts the password passed and calls the useradd call. # # NOTES # # # MODIFIED (MM/DD/YY) # adeb 09/19/05 - adeb_clone_creds # prayarot 9/14/05 - wrote script # adeb 09/14/05 - Creation # $ENV{PATH} = "/bin:/usr/bin:/usr/local/bin:/usr/sbin"; use Getopt::Long; use strict; main(); sub main() { print "\nThis is User Add Script\n"; my %cmdLine = (); GetOptions(\%cmdLine, "username=s", "password=s" ); my ($username, $password); if(exists $cmdLine{"username"}) { $username = $cmdLine{"username"}; } if(exists $cmdLine{"password"}) { $password = $cmdLine{"password"}; } my $cryptCmd = crypt($password,"Xa"); #my $result = system($cryptCmd); my $command = "useradd -p $cryptCmd $username"; system($command); }