blob: 6ceafae8795283e37e67d83c4b86b9493e162938 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# htmpasswd
h**tmp**asswd is a script to help create temporary users in files made with
`htpasswd`.
This script assumes your htpasswd-files are stored in `/etc/nginx/htpasswd`
(you can change this with the variable `$HTDIR`). It also needs access to
`/var/spool/htmpasswd`, where the temporary users are stored until they expore.
`htmpasswd` takes two arguments. `$1` is the name of the password-file, and `$2`
is the name of the temporary user. `$2` is optional. The script returns a
temprary username and password separated by aa colon.
Exaample:
```
$ sudo htmlpasswd f.dnns.no
woeomu:aadscv
```
This would now be valid at https://woeomu:aadscv@f.dnns.no.
## cron
In order to automagically remove the temporary users after a set aamount of
time, the script also needs to be invoked regularly by cron. When run by cron,
it taakes no arguments.
For the script to recognize it's being run by cron, you either need to set the
environmental variable `$RUN_BY_CRON` to `true`, or you can name the script
`htmpasswd-cron` (the script will recognize the `-cron`-suffix).
|