← timknutsen.no

ChatGPT on Windows, connected to a server over SSH

Install the ChatGPT desktop app, switch on an SSH host, and let Codex fix the connection when it fails. About a minute and a half of video, then the same steps in writing.

88 seconds · Windows 10 and 11 · screens are simplified illustrations; labels may differ in your app version.

Before you start

The app shows Norwegian labels if Windows is set to Norwegian. They are given in grey below.

Steps

  1. Install the app from the Microsoft Store

    Open the Microsoft Store, search for ChatGPT, and pick the app whose publisher is OpenAI. Skip the look-alikes. Click Get.

  2. Open the app and log in

    Click Open, then Log in. Sign-in finishes in your browser.

  3. Add your server and switch it on

    Open Settings. Under the Coding (Koding) group, open Connections (Tilkoblinger), then the SSH tab.

    Click Add (Legg til). Type the server's full address in the top field, give it a short Alias, and click Save (Lagre). Then switch the host on.

    The first try usually fails with Error · SSH connection failed (Feil · SSH-tilkobling mislyktes), because passwordless login isn't set up yet. Hover the ⓘ icon to see the reason, typically Host key verification failed.

  4. Ask a local chat to fix passwordless login

    Start a new chat on this PC (not on the server) and ask:

    Fix passwordless SSH login to devbox and give me the script to run on the server

    Codex checks your SSH setup, creates a key if the PC has none, and gives you a short Bash script that adds the key on the server.

  5. Run the script in a separate terminal

    Open a separate PowerShell window and log in to the server with your password:

    ssh you@devbox.example.com

    Paste and run the script there. Then go back to the chat and type done. Codex tests the login again and confirms that it works without a password.

    Never type the server password in the chat. Type it only in your own terminal window.
  6. Install Codex CLI on the server

    If the host then shows Codex CLI is not installed on this remote machine (Codex CLI er ikke installert på denne eksterne maskinen), ask in the same chat:

    Codex CLI isn't installed on devbox. Install it over SSH now.

  7. Reconnect, sign in, and pick a folder

    Back in Settings › Connections › SSH, click Reconnect (Koble til på nytt). Codex on the server isn't signed in yet, so you're asked to sign in: use your work email. Wait until the host says Connected (Tilkoblet).

    Click the folder icon on the host row and open a project folder on the server. Chats in that project now run on the server.

Doing steps 4 to 6 by hand

If you'd rather not let Codex do it, the same fixes take three commands in PowerShell on the PC. Replace devbox with your host alias.

# 1. Accept the server's host key (answer "yes" once, then log out)
ssh devbox

# 2. Create a key and copy it to the server (asks for the server password once)
ssh-keygen -t ed25519
type $env:USERPROFILE\.ssh\id_ed25519.pub | ssh devbox "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

# 3. Check that login no longer asks for a password, and that Codex is found
ssh devbox "bash -lc 'which codex'"

If which codex prints nothing, install Codex CLI on the server (it needs Node.js) and sign in once:

npm install -g @openai/codex
codex

The app starts Codex through the server's login shell, so codex must be on the PATH there.

Troubleshooting

Status in the appWhat it meansFix
Error · SSH connection failed, Host key verification failedThe PC doesn't trust the server yet, or has no key it accepts.Steps 4 and 5, or ssh devbox once and answer yes.
Connecting · Codex CLI is not installed on this remote machineSSH works, but codex isn't on the server's login PATH.Step 6, or install it by hand.
Connected, but chats failCodex on the server isn't signed in.Click Reconnect and sign in with your work email, or run codex on the server once.
The host isn't listedIt hasn't been added yet.Step 3: Add, then address and alias.