publapi/utils/signup-script-template

21 lines
883 B
Plaintext
Raw Normal View History

2023-01-21 22:19:17 +05:30
#!/bin/bash
# Path: /var/publapi/users/{{username}}.sh
# This file is generated by PublAPI. Do not edit this file.
echo "E-Mail of {{username}} is {{email}}."
useradd -Um -s /bin/bash {{username}}
chmod 711 /home/{{username}}
printf "%s\n%s" "${pass}" "${pass}" | passwd {{username}}
2023-01-21 22:29:54 +05:30
usermod -aG users {{username}}
2023-01-21 22:19:17 +05:30
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}}
setquota -u {{username}} 20G 20G 0 0 /