#!/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"