PWD::PwBasic - Perl interface to edit the Apache .htpasswd file.
$user = "UserName"; $nuser = "NewUserName"; $pass = "PassWord"; $passfile = "/www/members/.htpasswd"; require PWD::PwBasic; # Return the line to add in the .htpasswd file for AuthType Basic. $pass = pwd_basic($user, $pass); # Add the user to the .htpasswd file for AuthType Basic. $add_pass = add_pwd_basic($user, $pass, $passfile); # Remove the user from the .htpasswd file for AuthType Basic. $rm_pass = rm_pwd_basic($user, $passfile); # Update the user in the .htpasswd file for AuthType Basic. $upd_pass = upd_pwd_basic($user, $nuser, $pass, $passfile); # Check for duplicate username for AuthType Basic. $dup_pass = dup_pwd_basic($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::PwBasic, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PWD::PwBasic
CPAN shell
perl -MCPAN -e shell install PWD::PwBasic
For more information on module installation, please visit the detailed CPAN module installation guide.