PWD::PwDigest - Perl interface to edit the Apache .htpasswd file.
$user = "UserName"; $nuser = "NewUserName"; $pass = "PassWord"; $realm = "Member Page"; $passfile = "/www/members/.htpasswd"; require PWD::PwDigest; # Return the line to add in the .htpasswd file for AuthType Digest. $pass = pwd_md5($user, $pass, $realm); # Add the user to the .htpasswd file for AuthType Digest. $add_pass = add_pwd_md5($user, $pass, $realm, $passfile); # Remove the user from the .htpasswd file for AuthType Digest. $rm_pass = rm_pwd_md5($user, $passfile); # Update the user in the .htpasswd file for AuthType Digest. $upd_pass = upd_pwd_md5($user, $nuser, $pass, $realm, $passfile); # Check for duplicate username for AuthType Digest. $dup_pass = dup_pwd_md5($user, $passfile);
$user = The username $nuser = The new username $pass = The password from the user $realm = The 'AuthName' in the .htaccess file $passfile = The password file where to store the passwords (.htpasswd)
To install PWD::PwDigest, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PWD::PwDigest
CPAN shell
perl -MCPAN -e shell install PWD::PwDigest
For more information on module installation, please visit the detailed CPAN module installation guide.