Skip to content

Commit 86ed46d

Browse files
fix(ec2): ssh config forces use of supplied keys (#5636)
## Problem Occasionally this error pops up: ![image](https://github.com/user-attachments/assets/28630fd3-569e-4307-914d-815669686ba4) ## Solution Add one line to ssh config that force agent to use the provided key. - `IdentitiesOnly yes`: only use identity file provided. More info here: https://www.ssh.com/academy/ssh/config --- <!--- REMINDER: Ensure that your PR meets the guidelines in CONTRIBUTING.md --> License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: Justin M. Keyes <[email protected]>
1 parent de33bb7 commit 86ed46d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/core/src/shared/sshConfig.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,16 @@ export class SshConfig {
170170
private getBaseSSHConfig(proxyCommand: string): string {
171171
// "AddKeysToAgent" will automatically add keys used on the server to the local agent. If not set, then `ssh-add`
172172
// must be done locally. It's mostly a convenience thing; private keys are _not_ shared with the server.
173-
173+
// "IdentitiesOnly yes" forces agent to only use provided identity file.
174+
// More details: https://www.ssh.com/academy/ssh/config
174175
return `
175176
# Created by AWS Toolkit for VSCode. https://github.com/aws/aws-toolkit-vscode
176177
Host ${this.configHostName}
177178
ForwardAgent yes
178179
AddKeysToAgent yes
179180
StrictHostKeyChecking accept-new
180181
ProxyCommand ${proxyCommand}
182+
IdentitiesOnly yes
181183
`
182184
}
183185

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "EC2 connect: remote connection will no longer fail with 'too many authentication attempt'"
4+
}

0 commit comments

Comments
 (0)