1 Answer
- Newest
- Most votes
- Most comments
3
Seems like you forget to provide the ubuntu username in your command. try:
ssh -i "path to pem" ubuntu@ip-address
Hi,
Thanks for you answer. I removed the sensitive data from the command, this is what I used:
ssh -i "~/path/to/pem" ubuntu@ec2----*.eu-west-2.compute.amazonaws.com
Relevant content
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 20 days ago
- AWS OFFICIALUpdated a year ago
Add -v and ensure that key is used.
OpenSSH_9.6p1, LibreSSL 3.3.6 debug1: Reading configuration data /Users/user/.ssh/config debug1: /Users/aj0312/.ssh/config line 1: Applying options for * debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files debug1: /etc/ssh/ssh_config line 54: Applying options for * debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling debug1: Connecting to ec2-18-135-142-222.eu-west-2.compute.amazonaws.com port 22. debug1: Connection established. debug1: identity file path/to/pem type -1 debug1: identity file path/to/pem-cert type -1 debug1: identity file path/.ssh/githubkey type 0 debug1: identity file path/.ssh/githubkey-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_9.6 debug1: Remote protocol version 2.0, remote software version OpenSSH_8.9p1 Ubuntu-3ubuntu0.6 debug1: compat_banner: match: OpenSSH_8.9p1 Ubuntu-3ubuntu0.6 pat OpenSSH* compat 0x04000000 debug1: Authenticating to ec2-18-135-142-222.eu-west-2.compute.amazonaws.com:22 as 'ubuntu' debug1: load_hostkeys: fopen /Users/aj0312/.ssh/known_hosts2: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: sntrup761x25519-sha51
The PEM file exists?
Please generate public key from private key and verify if it is match with server public key. ssh-keygen -f <path of pem file> -y. You can try to login through Systems Manager also. Nowadays some EC2 instances are coming with Systems Manager pre-installed.
The PEM file exists and I have double and triple checked it's path.
How can I know if the EC2 instance has systems manager? I launched the instance a couple months ago