caddy-retired/scripts/mkuser

22 lines
483 B
Bash
Executable File

#!/bin/bash
DIR=$(dirname "$(dirname "$(readlink -f "$0")")") || exit
sudo userdel caddy
sudo groupadd caddy
sudo groupmod --gid 937 caddy
sudo useradd --system \
-m \
--uid 937 \
--gid caddy \
--create-home \
--home-dir "$DIR" \
--shell /bin/bash \
--comment "Caddy web server" \
caddy
sudo passwd caddy
sudo usermod -a -G caddy $USER
sudo chown -R caddy:caddy "$DIR"
sudo chmod g+rw -R "$DIR"
cat /etc/passwd | grep caddy
cat /etc/passwd | grep sysadmin
$DIR/scripts/own