Move usermod to install_docker function.
This commit is contained in:
parent
811f61ddb4
commit
b0f8797bcf
11
setup.sh
11
setup.sh
@ -49,7 +49,10 @@ install_docker() {
|
|||||||
systemctl start docker
|
systemctl start docker
|
||||||
systemctl enable docker
|
systemctl enable docker
|
||||||
echo "Docker installation complete."
|
echo "Docker installation complete."
|
||||||
docker_installed=true # Set the flag to true
|
|
||||||
|
usermod -aG docker "$username"
|
||||||
|
echo "User $username added to the docker group."
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to create a limited user account
|
# Function to create a limited user account
|
||||||
@ -65,12 +68,6 @@ create_user_account() {
|
|||||||
useradd -m -G wheel "$username"
|
useradd -m -G wheel "$username"
|
||||||
echo "$username:$password" | chpasswd
|
echo "$username:$password" | chpasswd
|
||||||
echo "User $username created and added to the wheel group."
|
echo "User $username created and added to the wheel group."
|
||||||
|
|
||||||
# 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
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user