2016-11-12 17:35:52 +00:00
|
|
|
# htpasswd
|
|
|
|
|
|
|
|
> Create and manage htpasswd files to protect web server directories using basic authentication.
|
2019-06-07 11:58:29 +01:00
|
|
|
> More information: <https://httpd.apache.org/docs/current/programs/htpasswd.html>.
|
2016-11-12 17:35:52 +00:00
|
|
|
|
|
|
|
- Create/overwrite htpasswd file:
|
|
|
|
|
2020-02-08 18:56:05 +00:00
|
|
|
`htpasswd -c {{path/to/file}} {{username}}`
|
2016-11-12 17:35:52 +00:00
|
|
|
|
|
|
|
- Add user to htpasswd file or update existing user:
|
|
|
|
|
2020-02-08 18:56:05 +00:00
|
|
|
`htpasswd {{path/to/file}} {{username}}`
|
2016-11-12 17:35:52 +00:00
|
|
|
|
2016-11-13 12:46:43 +00:00
|
|
|
- Add user to htpasswd file in batch mode without an interactive password prompt (for script usage):
|
2016-11-12 17:35:52 +00:00
|
|
|
|
2020-02-08 18:56:05 +00:00
|
|
|
`htpasswd -b {{path/to/file}} {{username}} {{password}}`
|
2016-11-12 17:35:52 +00:00
|
|
|
|
|
|
|
- Delete user from htpasswd file:
|
|
|
|
|
2020-02-08 18:56:05 +00:00
|
|
|
`htpasswd -D {{path/to/file}} {{username}}`
|
2016-11-12 17:35:52 +00:00
|
|
|
|
|
|
|
- Verify user password:
|
|
|
|
|
2020-02-08 18:56:05 +00:00
|
|
|
`htpasswd -v {{path/to/file}} {{username}}`
|
2019-12-24 13:57:59 +00:00
|
|
|
|
|
|
|
- Display a string with username (plain text) and password (md5):
|
|
|
|
|
2020-02-08 18:56:05 +00:00
|
|
|
`htpasswd -nbm {{username}} {{password}}`
|