#!/bin/bash DIR=$(dirname "$(dirname "$(readlink -f "$0")")") || exit UID=${1:-937} sudo userdel caddy sudo groupadd caddy # change uid to your liking. Best if same on all instances sudo groupmod --gid $UID caddy sudo mkdir -p $DIR/user sudo useradd --system \ -m \ --uid 937 \ --gid caddy \ --create-home \ --home-dir "$DIR/user" \ --shell /bin/bash \ --comment "Caddy web server user" \ caddy sudo passwd caddy # add current user to caddy group for rw access sudo usermod -a -G caddy $USER cat /etc/passwd | grep caddy cat /etc/passwd | grep sysadmin $DIR/scripts/own