14 lines
330 B
Bash
Executable File
14 lines
330 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
set -u
|
|
#check si il y a un argument et exit 1 si y'a pas
|
|
if [ ! "$1" ] ; then
|
|
echo "Usage : $0 user >> /var/www/html/dokuwiki/conf/users.auth.php"
|
|
exit 1
|
|
fi
|
|
|
|
# chiffremment du mot de passe $1 avec bcrypt
|
|
hashpass=$(htpasswd -bnBC 10 "" "${1}"|tr -d '\d')
|
|
echo "${1}${hashpass}:${1}:${1}@localhost:${1},user"
|