htpasswd
htpasswd is used to create and update the flat-files used to store usernames and password for basic authentication of HTTP users.[1]
Documentation
- man 1 'htpasswd' [EN]
Syntax
htpasswd [PARAMETER ...] [FILE] USER [PASSWORD]
Parameters
- -B
- Use bcrypt encryption for passwords. This is currently considered to be very secure.
- -c
- Create the passwdfile. If passwdfile already exists, it is rewritten and truncated.
- -C
- This flag is only allowed in combination with -B (bcrypt encryption). It sets the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 31).
- -D
- Delete user. If the username exists in the specified htpasswd file, it will be deleted.
- -i
- Read the password from stdin without verification (for script usage).
- -v
- Verify password. Verify that the given password matches the password of the user stored in the specified htpasswd file. Available in 2.4.5 and later.
Examples
- Create a new file and add the user "alex"
htpasswd -c -B '/var/www/htusers' 'alex'
References
- ↑ man 1 'htpasswd'