#!/bin/bash # Create a basic authentication file for Nginx # 1. Check if htpasswd command is available if ! command -v htpasswd &> /dev/null then echo "htpasswd could not be found, please install apache2-utils or httpd-tools." sudo apt-get update && sudo apt-get install -y apache2-utils fi # 2. Create the password file with at least one user echo "Create an admin user for basic authentication." htpasswd -c ./data/auth/.htpasswd admin echo "Basic authentication file created at ./data/auth/.htpasswd"