by andreacomo on WordPress.org
Sync your WordPress users with .htpasswd file for enabling Apache (2.2.18 and above) basic authentication based on file for your resources

Htpasswd Generator settings page
Want to protect resources in a folder only to registered users in your WordPress installation? This plugin sync any WP users with Apache basic authentication system file-based automagically: accessing protected resources will prompt for WordPress account credentials
If you want to protect resources with WordPress credential on another server, you can provide FTP credentials:
this plugin will take care to copy .htpasswd_generated to remote server. It’s up to you then to configure Apache .htaccess file propertly.