Correct issue with docker group being added to user.
This commit is contained in:
parent
fafdafa022
commit
811f61ddb4
6
setup.sh
6
setup.sh
@ -6,6 +6,7 @@
|
||||
# Variables
|
||||
timezone="America/New_York"
|
||||
sshd_config="/etc/ssh/sshd_config"
|
||||
docker_installed=false
|
||||
|
||||
# Function to prompt for hostname
|
||||
prompt_for_hostname() {
|
||||
@ -48,6 +49,7 @@ install_docker() {
|
||||
systemctl start docker
|
||||
systemctl enable docker
|
||||
echo "Docker installation complete."
|
||||
docker_installed=true # Set the flag to true
|
||||
}
|
||||
|
||||
# Function to create a limited user account
|
||||
@ -64,8 +66,8 @@ create_user_account() {
|
||||
echo "$username:$password" | chpasswd
|
||||
echo "User $username created and added to the wheel group."
|
||||
|
||||
# Check if Docker is installed and add the user to the docker group
|
||||
if command -v docker &> /dev/null; then
|
||||
# Add the user to the docker group if Docker is installed
|
||||
if [ "$docker_installed" = true ]; then
|
||||
usermod -aG docker "$username"
|
||||
echo "User $username added to the docker group."
|
||||
fi
|
||||
|
||||
Loading…
Reference in New Issue
Block a user