Enable basic password protection in user homepage
Use this if you don't have access to the apache2.conf:
Note: This assumes that /etc/apache2/apache2.conf is configured by the admin like this:
Reload Apache.
If you have access to the apache2.conf:
$ htpasswd -c ~/htpasswd ako
$ sudo chmod 644 ~/htpasswd
$ vim ~/public_html/private/.htaccess
AuthUserFile /home/*/htpasswd
AuthGroupFile /dev/null
AuthName "Private folder"
AuthType Basic
require valid-user
$ chmod 644 ~/public_html/private/.htaccess
Note: This assumes that /etc/apache2/apache2.conf is configured by the admin like this:
<Directory /home/*/public_html>
AllowOverride FileInfo AuthConfig Limit
Options Indexes SymLinksIfOwnerMatch IncludesNoExec
</Directory>
Reload Apache.
If you have access to the apache2.conf:
$ sudo htpasswd -c /etc/apache2/.htpasswd ako
$ sudo chmod 644 /etc/apache2/.htpasswd
$ sudo vim /etc/apache2/apache2.conf
<Directory /home/*/public_html/private>
AuthUserFile /etc/apache2/.htpasswd
AuthGroupFile /dev/null
AuthName "Private folder"
AuthType Basic
require valid-user
</Directory>