HostOnNet Blog

Managing users with Apache htpasswd

Looking for Linux Server Admin or WordPress Expert? We can help.

htpasswd is used to create and update the flat-files used to store usernames and password for basic authentication of HTTP users.

On Ubuntu server, you can install htpasswd with command

apt -y install apache2-utils

To create a password file and add user, run

htpasswd -b -c /etc/squid/passwd USERNAME_HERE PASSWORD_HERE

In above example, it create a file /etc/squid/passwd and add specified user and password.

-c == create password file. If already exits, overwrite it.
-b == get password from command line.

Add a user to existing passwd file.

You can run above command with out -c option. This will add new user to existing passwd file.

htpasswd -b /etc/squid/passwd USERNAME_HERE PASSWORD_HERE

Posted in Apache

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.