deployment-dcdn/install.sh

42 lines
768 B
Bash
Raw Normal View History

2024-02-23 14:28:42 +01:00
#!/bin/bash
echo "Deployment Debian + Caddy + Directus + Nuxt"
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
fi
#
# USER
#
echo "Create user"
read -p "Enter username: " username
if id "$username" &>/dev/null; then
echo "User '$username' already exists."
exit 1
fi
echo "Generate and store the password somewhere safe"
read -s -p "Enter password: " password
echo
2024-02-23 14:35:26 +01:00
useradd -m "$username"
2024-02-23 14:28:42 +01:00
echo "$username:$password" | chpasswd
usermod -aG sudo $username
echo "User '$username' created with password successfully."
#
# SSH
#
echo "Setup SSH"
touch /etc/ssh/sshd_config.d/custom.conf
echo "PermitRootLogin no" >> /etc/ssh/sshd_config.d/custom.conf
echo "PermitEmptyPasswords no" >> /etc/ssh/sshd_config.d/custom.conf
systemctl reload ssh