This article explains how to password protect your folder through SSH via developing an .Htaccess and .Htpasswd file. The following steps are covered in this article.
Creating the .htpasswd file
Creating the .htaccess file
Log into your server via SSH.
Create an .Htpasswd document in the listing you wish to password defend using the the htpasswd application. For the first person, say USERNAME, run the subsequent:
[root#] htpasswd -c /var/www/html/test/.htpasswd USERNAME
It will ask a new password
Enter the password for the user. This creates a password for a user named 'USERNAME'. The code in your .htpasswd file will show the encrypted password like this:
USERNAME:GdyerBV64bdj=
Creating the .htaccess file
[server]$ vi .htaccess
#Protect Directory
AuthName "Dialog prompt"
AuthType Basic
AuthUserFile /var/www/html/test/.htpasswd
Require valid-user