aws / aws/aws-ec2-instance-connect-config

Permission Denied after "Successfully pushed the public key"

Open
#32 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Shell
Stars
88
Forks
39
PR merge metrics
No merged PRs in 30d

Description

When running the following command on mac os:
```
mssh -d -r eu-west-2 i-XXXXXXXXXXXXXXX
```
I get the following output
```txt
2021-07-24 19:15:58,821 - botocore.httpsession - DEBUG - Certificate path: /usr/local/lib/python3.9/site-packages/botocore/cacert.pem
2021-07-24 19:15:59,629 - botocore.parsers - DEBUG - Response headers: {'x-amzn-RequestId': 'cec3279a-c220-45b7-b99b-930c0a7a8fe0', 'Content-Type': 'application/x-amz-json-1.1', 'Content-Length': '67', 'Date': 'Sat, 24 Jul 2021 23:15:59 GMT'}
2021-07-24 19:15:59,629 - botocore.parsers - DEBUG - Response body:
b'{"RequestId":"cec3279a-c220-45b7-b99b-930c0a7a8fe0","Success":true}'
2021-07-24 19:15:59,629 - botocore.hooks - DEBUG - Event needs-retry.ec2-instance-connect.SendSSHPublicKey: calling handler
2021-07-24 19:15:59,629 - botocore.retryhandler - DEBUG - No retry needed.
2021-07-24 19:15:59,631 - EC2InstanceConnect - DEBUG - Successfully pushed the public key to i-XXXXXXXXXXXXXXX
2021-07-24 19:15:59,632 - EC2InstanceConnect - DEBUG - Generated command: ssh -o "IdentitiesOnly=yes" -i /var/folders/vk/11pm_tqj4llb5h4j36cqp7480000gn/T/tmpsb6y5b8t ec2-user@35.176.217.237
ec2-user@35.176.217.237: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
2021-07-24 19:16:03,205 - EC2InstanceConnect - DEBUG - Deleting the private key file: /var/folders/vk/11pm_tqj4llb5h4j36cqp7480000gn/T/tmpsb6y5b8t
```
You can see the final lines suggest the temporary key was successfully pushed, yet get permission denied after that. The time sync solution reported by others did not solve my problem.
This is rather strange since I am able to mssh into other instances, all of which are Amazon Linux 2. I am doing all of this from a mac.
Any help would be really appreciated :)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the macOS mssh command and reviewing the logged EC2 Instance Connect response and generated SSH command. Compare the failing instance with the Amazon Linux 2 instances that accept mssh; done means the temporary key is accepted and the SSH session opens without Permission denied.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, linux, macos, shell
Domain
authentication, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.