Optional: passwordless SSH key setup
====================================

Only needed if you want deploy WITHOUT typing the server password every time.
Default product mode is password prompt (auth_mode: password).


STEP 1 — Create a key on THIS Windows PC
----------------------------------------
Open PowerShell:

New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.ssh" | Out-Null
ssh-keygen -t ed25519 -f "$env:USERPROFILE\.ssh\id_ed25519" -N '""'

If asked to overwrite an existing key, answer carefully (usually "n" if you already use that key).


STEP 2 — Copy public key to YOUR VPS (password once)
----------------------------------------------------
Replace YOUR_SSH_USER and YOUR_VPS_HOST:

Get-Content "$env:USERPROFILE\.ssh\id_ed25519.pub" | ssh YOUR_SSH_USER@YOUR_VPS_HOST "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys"

You will enter YOUR server password one time for this step.


STEP 3 — Test passwordless login
--------------------------------
ssh -o BatchMode=yes YOUR_SSH_USER@YOUR_VPS_HOST "echo OK"

Must print OK with NO password prompt.


STEP 4 — Enable key mode in settings
------------------------------------
Open SETUP-First\CHANGE-Settings.yaml and set:

  deploy:
    auth_mode: "ssh"
    ssh_key_path: "C:/Users/YOUR_WINDOWS_USERNAME/.ssh/id_ed25519"

Or copy values from:
  Auto-password-ssh-setup\CHANGE-Settings-SSH-Key-Snippet.yaml


STEP 5 — Publish with key mode
------------------------------
powershell -ExecutionPolicy Bypass -File .\app\scripts\run_publish.ps1 -ImageSet 1 -AuthMode ssh


SECURITY
--------
- Never put your server password into any product file.
- Never share your private key (id_ed25519) with anyone.
- Only the public file (id_ed25519.pub) is copied to the server.
