From 673f55949d54075d60bae650d14f95c043311814 Mon Sep 17 00:00:00 2001 From: qt Date: Thu, 27 Jul 2023 16:47:50 +0000 Subject: [PATCH] Upload files to '' account creation script --- acctsetup.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 acctsetup.sh diff --git a/acctsetup.sh b/acctsetup.sh new file mode 100644 index 0000000..76ce904 --- /dev/null +++ b/acctsetup.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +#tilde.32bit.cafe account creation script. Requires a username and an email as an argument + +if [ -z "$1" ] ; then + echo "Must provide username and email! ex acctcreate qt howdy@qt314.me" + exit +fi + +username=$1 +email=$2 + +useradd -m --comment $email $username + +mkdir /home/$username/www +cp /root/index.html /home/$username/www/index.html +cp /root/readme.txt /home/$username/ + +#update placeholder text in default index.html +sed -i "s/USERNAME/$username/g" /home/$username/www/index.html + +#create symlink from webroot to user's home dir +ln -s /home/$username/www/ /var/www/\~$username + +#update permissions +chown $username:caddy /var/www/\~$username +chown -R $username:$username /home/$username +chown -R $username:caddy /home/$username/www +chmod -R 644 /home/$username/www/ +chmod 754 /home/$username/www + +#force everything in /home/$username/www to be in the caddy group. Allows web server to read these files +chmod g+s /home/$username/www + +#set dick space usage limits. Settings are copied from user qt +edquota -p qt $username + +echo "Setup complete"