Solved

htpasswd - how do I set the username and passwd

Posted on 2001-08-23
2
409 Views
Last Modified: 2006-11-17
How do I set the user name and password in a .htpasswd file?  Sorry to ask such a newbie question.  I have an old .htpasswd file but can't remember how to add username/passwd pairs.
0
Comment
Question by:webmommy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 6

Accepted Solution

by:
bira earned 100 total points
ID: 6420125
To create the .htpasswd file, use the htpasswd command with the following format:
htpasswd [-c] .htpasswd {username}
This command line will prompt you for a password for that user. The password that you type will not be echoed onto the screen, and it will be immediately encrypted.

The output from this command is a .htpasswd file with an entry with the form:
{user}:{encrypted password}
The -c option creates a new passwd file instead of editing an old one. So only use the -c option the first time the htpasswd command is used.

Finally, make sure that read permissions for this file are set for everyone (ie. owner, group, and other).

0
 
LVL 6

Expert Comment

by:bira
ID: 6420156
The format of the password file is straightforward, one line per user, with the line containing the user name, followed by a colon, followed by the user's password encrypted with the standard Unix password encryption. The <crypt> tag can be used to encrypt such a password.
In other words, an .htpasswd can look like this:

   frotz:taeWr6tbTZKO6
   gnusto:jKXVnZH6eXR7

with one line for each user.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question