From ce9fb00a466881defdbd3a4bb51a8d21680d6ca2 Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Mon, 23 Jan 2023 14:12:05 +0530 Subject: [PATCH] Add password generator to signup template --- utils/signup-script-template | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/signup-script-template b/utils/signup-script-template index 20e8d95..70a63a7 100644 --- a/utils/signup-script-template +++ b/utils/signup-script-template @@ -2,18 +2,19 @@ # Path: /var/publapi/users/{{username}}.sh # This file is generated by PublAPI. Do not edit this file. echo "E-Mail of {{username}} is {{email}}." +pass="$(tr -dc A-Za-z0-9 /home/{{username}}/pass +chmod 600 /home/{{username}}/pass +chown {{username}}:username /home/username/pass usermod -aG users {{username}} mkdir /home/{{username}}/.ssh echo "{{sshkey}}" > /home/{{username}}/.ssh/authorized_keys chmod 700 /home/{{username}}/.ssh chmod 600 /home/{{username}}/.ssh/authorized_keys chown -R {{username}}:username /home/username/.ssh -echo "${pass}" > /home/{{username}}/pass -chmod 600 /home/{{username}}/pass -chown {{username}}:username /home/username/pass sed -i 's/REPLACEME/{{username}}/g' /home/username/{meta-info.env,Caddyfile} sed -i 's/EMAIL=/EMAIL={{email}}/' /home/{{username}}/meta-info.env loginctl enable-linger {{username}}