Hi ,
we have a customized code for changing the password (File is a cgi), where the user can execute command "/usr/bin/passwd to change the password. This is happening with out any issues . Now the new requiremnt is to add the expire functunality to that code i.e passwd -x 19 $user_name
Now when ever i run the expire command through the CGI , i am getting permission denied .
I want to be able to execute the expire command ,with out the error of permission denied ?
I have a id with root access but when user enter teamsite all will not have root permissiom
Please Help !! any suggestion will be good as i have tried looking in the net and cant find any thing which is anwering my question
Code : Working
sub changepasswd {
$passwd="/usr/bin/passwd $user_name";
print "
";
print "Changing Unix password for user $user_name \n";
($nis_passwd=Expect->spawn("$passwd")) ||
&print_error("Unable to spawn $passwd $user_name\n");
$nis_passwd->expect(10,"Enter login password: ");
print $nis_passwd "$oldpass\r";
$nis_passwd->expect(10,"New password: ");
print $nis_passwd "$pass1\r";
$nis_passwd->expect(10,"Re-enter new password: ");
print $nis_passwd "$pass2\r";
#Must soft close this file handle otherwise on some system
$nis_passwd->soft_close();
}
We need to implement expire command also to the above code :
What i have tried :
sub changepasswd
{
$passwd="passwd -x 19 $user_name";
print "Changing Unix password for user $user_name \n";
($nis_passwd=Expect->spawn("$passwd")) ||
&print_error("Unable to spawn $passwd $user_name\n");
$nis_passwd->expect(10,"Enter login password: ");
print $nis_passwd "$oldpass\r";
$nis_passwd->soft_close();
}