Create htpasswd file for current (pwd) path
htpasswd -mc .htpasswd yourusername
Insert new password Create .htaccess file for current path
touch .htaccess mcedit .htaccess
Paste this lines to .htaccess file
AuthName "Login to the Private Area"
AuthType Basic
AuthUserFile /var/www/html/{protected_dir}/.htpasswd
Require user {username}
[notice]Change {username} and {protected_dir} for your own[/notice]