Download run.py from userrein/Run: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/spaces/userrein/Run/resolve/main/run.py
- Command line
-
hf download hf://spaces/userrein/Run/run.py
-
curl -L -o run.py https://huggingface.co/spaces/userrein/Run/resolve/main/run.py
1 kB
| import os | |
| import time | |
| # Install SSH server | |
| os.system("apt update && apt install -y openssh-server unzip") | |
| # Set password root | |
| os.system("echo 'root:123456' | chpasswd") | |
| # Izinkan login root via password | |
| os.system("sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config") | |
| os.system("sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config") | |
| # Start SSH | |
| os.system("service ssh start") | |
| # Download & install ngrok | |
| os.system("wget -O ngrok.zip https://bin.equinox.io/c/bNyj1mQVY4c/ngrok-v3-stable-linux-amd64.zip") | |
| os.system("unzip ngrok.zip") | |
| os.system("chmod +x ngrok") | |
| # Masukkan auth token ngrok (WAJIB) | |
| NGROK_TOKEN = "3C0LPg1zjf8Ui52LQnfPnD8RYAp_Y8Ps2ghwf2yCNvhL7vit" | |
| os.system(f"./ngrok config add-authtoken {NGROK_TOKEN}") | |
| # Jalankan tunnel TCP ke port 22 (SSH) | |
| os.system("./ngrok tcp 22 &") | |
| print("Tunggu 10 detik untuk link SSH...") | |
| time.sleep(10) | |
| # Ambil info tunnel | |
| os.system("curl -s http://127.0.0.1:4040/api/tunnels") |