set random password

This commit is contained in:
Paolo Asperti 2024-12-13 10:45:43 +01:00
parent fd3195a8b2
commit a1a52d3f89
Signed by: paspo
GPG Key ID: 06D46905D19D5182

View File

@ -3,7 +3,8 @@
WEBROOT=/www WEBROOT=/www
PHP=${PHP:-none} PHP=${PHP:-none}
USERNAME=${USERNAME:-theuser} USERNAME=${USERNAME:-theuser}
adduser -DH -h "${WEBROOT}" -G "nginx" -u "1000" "${USERNAME}" RANDOMPWD=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 13)
printf '%s\n%s' "${RANDOMPWD}" "${RANDOMPWD}" | adduser -DH -h "${WEBROOT}" -G "nginx" -u "1000" "${USERNAME}"
chown "${USERNAME}:nginx" "${WEBROOT}" -R chown "${USERNAME}:nginx" "${WEBROOT}" -R
find "${WEBROOT}" -type d -exec chmod 0755 {} \; find "${WEBROOT}" -type d -exec chmod 0755 {} \;