From 87b17fa1cc4229b7c549c7e230a18ea109718399 Mon Sep 17 00:00:00 2001 From: joglomedia Date: Thu, 15 Aug 2019 22:08:49 +0700 Subject: [PATCH] Fix issue #11 --- lemper.sh | 6 +++--- scripts/helper.sh | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lemper.sh b/lemper.sh index 4073c58..1f426a3 100755 --- a/lemper.sh +++ b/lemper.sh @@ -270,9 +270,9 @@ Now, you can reboot your server and enjoy it!" run apt-get autoremove -y status -e "\nLEMP stack has been removed completely." - warning -e "\nDid you know? that we're sad to see you leave :'( -If you are not satisfied with LEMPer stack or -have any reasons to uninstall it, please let us know ^^" + warning -e "\nDid you know? that e're sad to see you leave :'( +If you are not satisfied with LEMPer stack or have +any other reasons to uninstall it, please let us know ^^" ;; --help) echo "Please read the README file for more information!" diff --git a/scripts/helper.sh b/scripts/helper.sh index b6d68b3..4c88bd6 100644 --- a/scripts/helper.sh +++ b/scripts/helper.sh @@ -464,6 +464,17 @@ function create_account() { run chown -hR "${USERNAME}:${USERNAME}" "/home/${USERNAME}/webapps" fi + # Add account credentials to /srv/.htpasswd + if [[ -n $(command -v mkpasswd) ]]; then + local PASSHASH=$(mkpasswd --method=sha-256 "${PASSWORD}") + run bash -c 'echo "${USERNAME}:${PASSHASH}" > /srv/.htpasswd' + elif [[ -n $(command -v htpasswd) ]]; then + run htpasswd -b /srv/.htpasswd "${USERNAME}" "${PASSWORD}" + else + local PASSHASH=$(openssl passwd -1 "${PASSWORD}") + run bash -c 'echo "${USERNAME}:${PASSWORD}" > /srv/.htpasswd' + fi + # Save data to log file. echo " Your default system account information: