deployment_ddcdn_multisite/bin/first-install/create_user.sh

22 lines
550 B
Bash

#!/bin/bash
echo -e "${PURPLE}${BOLD}Create user${RESET}"
read -p "Enter username: " USERNAME
if id "$USERNAME" &>/dev/null; then
echo "User '$username' already exists."
exit 1
fi
echo -e "${ORANGE}${BOLD}Generate and store the password somewhere safe${RESET}"
read -s -p "Enter password: " password
echo
useradd -m "$USERNAME"
chsh -s /bin/bash $USERNAME
echo "$USERNAME:$password" | chpasswd
usermod -aG sudo $USERNAME
usermod -aG docker $USERNAME
echo -e "${PURPLE}${BOLD}User '$USERNAME' created with password successfully.${RESET}"