Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

htpasswd - how do I set the username and passwd

Posted on 2001-08-23
2
Medium Priority
?
421 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
  • 2
2 Comments
 
LVL 6

Accepted Solution

by:
bira earned 400 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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
Course of the Month9 days, 17 hours left to enroll

926 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