Skip to content

fix(ssh): include the Coder SSH config where OpenSSH reads it off Windows - #1226

Merged
EhabY merged 1 commit into
mainfrom
fix/ssh-home-from-passwd
Dec 2, 2026
Merged

EhabY merged 1 commit into
mainfrom
fix/ssh-home-from-passwd

Conversation

@EhabY

@EhabY EhabY commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

Part of VSC-58

Stack: #1221 (Git for Windows) → this PR → #1227 (SshConfig class to module functions).

Off Windows, OpenSSH reads .ssh/config from the passwd entry's home and ignores HOME. The extension found the user's config through os.homedir(), which follows HOME. With HOME pointing elsewhere (an overridden HOME, some containers and shells), the include block went into $HOME/.ssh/config, a file ssh never opens, and the workspace host got no ProxyCommand. Raised in the #1221 review.

  • User config: written under getSshHomeDir(). Off Windows that is os.userInfo().homedir (the passwd entry), with os.homedir() as the fallback when there is no passwd entry. On Windows it is unchanged.
  • Include line: OpenSSH expands ~ in Include from HOME in 8.9 (checked on Ubuntu) but from the passwd entry in 10.2 (the reviewer's check). So ~/... is written only when both are the same directory; otherwise the include gets the absolute path, which every version reads.

prod +31/−14, tests +65/−1.

Testing: unit tests mock the passwd entry and cover the fallback. A real-ssh test sets HOME to the fixture's parent and resolves the host. It runs on Linux and macOS CI and is skipped on Windows. The OpenSSH 8.9 behavior above was checked by hand in WSL.


🤖 Generated with Claude Code

@linear-code

linear-code Bot commented Nov 30, 2026

Copy link
Copy Markdown

VSC-58

@EhabY
EhabY force-pushed the fix/ssh-home-from-passwd branch from 9c562ec to 769cde0 Compare December 1, 2026 22:07
@EhabY
EhabY force-pushed the fix/ssh-home-from-passwd branch from 769cde0 to 0b7eb7a Compare December 2, 2026 10:24
Base automatically changed from fix/vsc-58-ssh-home-from-homedrive to main December 2, 2026 10:37
…dows

OpenSSH reads ~/.ssh/config from the passwd entry and ignores HOME, but
the extension wrote the include into $HOME/.ssh/config through
os.homedir(). With HOME pointing elsewhere, ssh never saw the include.

- Write the user's config under the passwd home (os.userInfo()), falling
  back to os.homedir() without a passwd entry.
- OpenSSH expands ~ in Include from HOME (8.9) or the passwd entry (10.2),
  so write ~/... only when both are the same directory, else the absolute
  path.
@EhabY
EhabY force-pushed the fix/ssh-home-from-passwd branch from 0b7eb7a to b0624f7 Compare December 2, 2026 10:37
@EhabY
EhabY merged commit 0454f42 into main Dec 2, 2026
17 checks passed
@EhabY
EhabY deleted the fix/ssh-home-from-passwd branch December 2, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants