Spaces:
Paused
Paused
Download start.sh from KimeraIRIS/K-Workspace: direct link, hf CLI and curl.
- Browser
- Download file 929 Bytes
-
https://huggingface.co/spaces/KimeraIRIS/K-Workspace/resolve/main/start.sh
- Command line
-
hf download hf://spaces/KimeraIRIS/K-Workspace/start.sh
-
curl -L -o start.sh https://huggingface.co/spaces/KimeraIRIS/K-Workspace/resolve/main/start.sh
929 Bytes
| set -euo pipefail | |
| # Read credentials from Hugging Face Secrets. | |
| # Supports either USERNAME/PASSWORD or username/password. | |
| USERNAME="${USERNAME:-${username:-}}" | |
| PASSWORD="${PASSWORD:-${password:-}}" | |
| ROOT_PASSWORD="${ROOT_PASSWORD:-${root_password:-$PASSWORD}}" | |
| if [[ -z "$USERNAME" || -z "$PASSWORD" ]]; then | |
| echo "ERROR: Missing USERNAME or PASSWORD secret." | |
| echo "Set them in your Hugging Face Space -> Settings -> Repository secrets." | |
| exit 1 | |
| fi | |
| # Ensure login user exists and can use sudo. | |
| if ! id -u "$USERNAME" >/dev/null 2>&1; then | |
| useradd -m -s /bin/bash "$USERNAME" | |
| fi | |
| usermod -aG sudo "$USERNAME" | |
| echo "${USERNAME}:${PASSWORD}" | chpasswd | |
| echo "root:${ROOT_PASSWORD}" | chpasswd | |
| # Start a web terminal protected with basic auth as the non-root user. | |
| # You can escalate with sudo, or switch to root using: su - | |
| exec ttyd -p 7860 -c "${USERNAME}:${PASSWORD}" sudo -u "$USERNAME" -H bash -l | |