Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jack2jm/b98af67e8e18460c85465e2085c8eac1 to your computer and use it in GitHub Desktop.

Select an option

Save jack2jm/b98af67e8e18460c85465e2085c8eac1 to your computer and use it in GitHub Desktop.
1. sudo apt install apache2-utils
(https://sleeplessbeastie.eu/2020/02/26/how-to-generate-password-digest-for-basic-authentication-of-http-users/)
Create .htaacess file
2. htpasswd -c /home/pwww/.htpasswd jerry
{Following command will creates a new file and stores a record in it for user jerry. The user is prompted for the password. If the file exists and cannot be read, or cannot be written, it is not altered and htpasswd will display a message and return an error status.}
3. Change or update password
htpasswd /home/pwww/.htpasswd-users tom
{***The user is prompted for the password.**}
2. paste this code to .htaaccess
AuthType Basic
AuthName "restricted area"
AuthUserFile /var/www/html/.htpasswd
require valid-user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment