'What is realm in htdigest?

htdigest needs the following parameters:

Usage: htdigest [-c] passwordfile realm username

What is the realm for? What value should I use to setup htdigest?



Solution 1:[1]

Anyway, realm denotes authentication domain for challenge-response. In the case of digest authentication realm value participates in the password hash, that why it is required when storing password files.

See https://www.rfc-editor.org/rfc/rfc2617#section-3.2.1 for details.

Solution 2:[2]

Usually the realm is the same that the authname in your .htaccess as it will be displayed at prompt for login and password

i.e:

<Location /prived/>
AuthName "Prived zone"
AuthType Digest
AuthUserFile /var/www/authfile/priveduser
AuthGroupFile /var/www/authfile/privedgroup
AuthDigestDomain /prived/ /protect/
Require group valid-users
</Location>

htdigest -c /var/www/authfile/priveduser "Prived zone" titi

Solution 3:[3]

When creating passwords with htdigest, 'realm' needs to match the 'AuthName' directive in your Apache config.

e.g., if your config for digest contains this:

AuthName abc1234xyz

then the htdigest command to create users will look like this:

htdigest /path/to/digestfile abc1234xyz username

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TechWisdom
Solution 2 Elwillow
Solution 3 evan_b