Basic authentication of HTTP users using htpasswd command

htpasswd is used to create and update the flat-files used to store usernames and password for basic authentication of HTTP users. If htpasswd cannot access a file, such as not being able to write to the output file or not being able to read the file in order to update it, it returns an error status and makes no changes.

Create a new password file

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.

# htpasswd -c /home/pwww/.htpasswd user

Change or update password

To add or modifies the password for user tom, enter:

# htpasswd /home/pwww/.htpasswd-users tom

The user is prompted for the password.

Related posts:

  1. How to mount smb share with credentials The /etc/fstab is readable by everyone so it obviously wouldn’t...
  2. linux disk quota Disk quota linux is explained below. To enable user quota...
  3. Essential Linux basic commands The following are the most commonly used commands ls :...
  4. How to force users to change their passwords when login The thing we need to do is lock the account...
  5. Shell script program to display calender and logined in users This shell script will display calender and logined in users...