Hi, I'm slowly learning perl, although I'm a network admin and don't use it on an everyday basis. I have what might be an easy question for you guys.
basically i have a server that passes 2 varibles (username and password) to a perl script on a linux server.
the problem is i need the home directory to be /home/1st letter of username/useranme ex: /home/t/test.
how can i take the username and create another variable with just the 1st letter of the original username varible ?
heres the script im using.
open(INFILE, "@ARGV[0]");
$infile = <INFILE>;
($username,$password) = split(/\|/, $infile);
close(INFILE);
@calladduser = ("/usr/sbin/adduser $username -g 503 -d /home/CANT GET THIS WORKING/$username -s /sbin/nologin -p $password","\n");
system("@calladduser");
# for the crypting of adduser -p, since we are using shadow passwds
# and adduser -p passes plain passwords.
@cryptpasswd = ("echo $password | passwd $username --stdin");
system("@cryptpasswd");
print ("New User $username has been successfully added!\n");
print ("New User password: $password\n");
$username\n");
open(OUTFILE, ">>/usr/local/private/platypusd/secure_dir/plat_adduser.log");
print OUTFILE ("@calladduser");
close(OUTFILE);
TIA, P.A
basically i have a server that passes 2 varibles (username and password) to a perl script on a linux server.
the problem is i need the home directory to be /home/1st letter of username/useranme ex: /home/t/test.
how can i take the username and create another variable with just the 1st letter of the original username varible ?
heres the script im using.
open(INFILE, "@ARGV[0]");
$infile = <INFILE>;
($username,$password) = split(/\|/, $infile);
close(INFILE);
@calladduser = ("/usr/sbin/adduser $username -g 503 -d /home/CANT GET THIS WORKING/$username -s /sbin/nologin -p $password","\n");
system("@calladduser");
# for the crypting of adduser -p, since we are using shadow passwds
# and adduser -p passes plain passwords.
@cryptpasswd = ("echo $password | passwd $username --stdin");
system("@cryptpasswd");
print ("New User $username has been successfully added!\n");
print ("New User password: $password\n");
$username\n");
open(OUTFILE, ">>/usr/local/private/platypusd/secure_dir/plat_adduser.log");
print OUTFILE ("@calladduser");
close(OUTFILE);
TIA, P.A