caddy-retired/scripts/mkuser

22 lines
483 B
Plaintext
Raw Normal View History

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