Turn IdentitiesOnly off for ssh to (closes #74) #85

Merged
clawbot merged 1 commits from issue-74-ssh-to-identitiesonly into next 2026-10-14 21:12:59 +02:00
Collaborator

keyfunc ssh to now runs ssh with -o IdentitiesOnly=no before the host, right after -o IdentityAgent=<socket>. When the user's ssh configuration sets IdentitiesOnly yes (often under Host *), ssh lists the agent's key but offers only keys named by IdentityFile. The derived key was never tried, and the login failed with Permission denied (publickey). An option on the command line wins over the configuration file. The tool's agent holds only the derived key, so turning the option off adds no other key.

TestIdentitiesOnlyIsTurnedOffBeforeTheHost in internal/cli/ssh_test.go requires the option between the agent option and the host in the arguments the stand-in ssh was given. TestSSHIsPointedAtTheAgentAndItsStatusIsHandedOn now expects the host as the fifth argument. The README's ssh to section names both options and says why the second one is there.

-o IdentityAgent stays the first option because the stand-in ssh scripts read the socket from their second argument.

Judgement call: ssh keeps the first value it is given for an option, so a user's own -o IdentitiesOnly=yes after the host is now overridden. With only the derived key in the agent, that setting could only stop the login.

Judgement call: keyfunc ssh to --help is unchanged. It names none of the options the tool passes, and the definition of done asks for help text only under the documentation-only option.

Fixes #74

Model: opus-5-5

`keyfunc ssh to` now runs `ssh` with `-o IdentitiesOnly=no` before the host, right after `-o IdentityAgent=<socket>`. When the user's ssh configuration sets `IdentitiesOnly yes` (often under `Host *`), `ssh` lists the agent's key but offers only keys named by `IdentityFile`. The derived key was never tried, and the login failed with `Permission denied (publickey)`. An option on the command line wins over the configuration file. The tool's agent holds only the derived key, so turning the option off adds no other key. `TestIdentitiesOnlyIsTurnedOffBeforeTheHost` in `internal/cli/ssh_test.go` requires the option between the agent option and the host in the arguments the stand-in `ssh` was given. `TestSSHIsPointedAtTheAgentAndItsStatusIsHandedOn` now expects the host as the fifth argument. The README's `ssh to` section names both options and says why the second one is there. `-o IdentityAgent` stays the first option because the stand-in `ssh` scripts read the socket from their second argument. Judgement call: `ssh` keeps the first value it is given for an option, so a user's own `-o IdentitiesOnly=yes` after the host is now overridden. With only the derived key in the agent, that setting could only stop the login. Judgement call: `keyfunc ssh to --help` is unchanged. It names none of the options the tool passes, and the definition of done asks for help text only under the documentation-only option. Fixes https://git.eeqj.de/sneak/keyfunc/issues/74 Model: opus-5-5
clawbot added the needs-review label 2026-10-14 20:44:55 +02:00
clawbot self-assigned this 2026-10-14 20:44:55 +02:00
clawbot added 1 commit 2026-10-14 20:44:55 +02:00
ssh to now gives ssh -o IdentitiesOnly=no before the host, next to
-o IdentityAgent. With IdentitiesOnly yes in the user's ssh
configuration, ssh listed the agent's key but never offered it, and
the login failed with Permission denied. An option on the command
line wins over the configuration, and the tool's agent holds only the
derived key, so turning the option off adds no other key. A test
against the stand-in ssh requires the option before the host, and the
README's ssh to section names both options.

Model: opus-5-5
Author
Collaborator

Review passed; ready to merge into next.

Model: opus-5-5

Review passed; ready to merge into `next`. Model: opus-5-5
clawbot merged commit 44cb5215b0 into next 2026-10-14 21:12:59 +02:00
clawbot deleted branch issue-74-ssh-to-identitiesonly 2026-10-14 21:12:59 +02:00
Sign in to join this conversation.