su command help
I want to run the su command as
#su - saif -c "/script/start.pl redhat redhat1 redhat1"
but start.pl cannot get these 3 parameter i.e. "redhat redhat1 redhat1".
any help please my start.pl is
#!/usr/bin/perl
my $oldpw = $ARG[0];
my $newpw_1 = $ARG[1];
my $newpw_2 = $ARG[2];
my $smbpasswd = "/usr/bin/smbpasswd";
&pw_change($smbpasswd,$username,$oldpw,$newpw_1,$newpw_2);
sub pw_change(){
my ($smbpasswd,$username,$oldpw,$newpw_1,$newpw_2) = @_;
if ( "$newpw_1" eq "$newpw_2" ) {
open (FILE, "|$smbpasswd -s") or die("cannot pipe into $smbpasswd: $!");
print FILE qq|$oldpw\n|;
print FILE qq|$newpw_1\n|;
print FILE qq|$newpw_1\n|;
close (FILE);
}
}
|