AWS Certified Solutions Architect - Associate (SAA-C02)

Sign Up Free or Log In to participate!

Failing to coonect with CLI on EC2 demo – cloud_user@174.129.162.116: Permission denied (publickey,gssapi-keyex,gssapi-with-mic). What must be the reason ?

using cmd from windows, and ssh to comnect to the VM instance created returns:

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

and process exits

3 Answers

Are you specifying the private key in your ssh command?  You need to use something like:


ssh -i private-key.pem cloud_user@174.129.162.116  

where private-key.pem should be the filename of the private key for the server you’re connecting to.

See ssh man page at https://linux.die.net/man/1/ssh

Sorin

yes, indeed, I do

David Bower

Can you copy & paste the whole ssh command you use and the output? Please do blank out any secret information as you copy it

Sorin

ssh johnsmith@174.129.162.116 -i MyAWSKeys.pem

CJ

cloud_user is for connecting to Playground. For connecting to your instance you need to use it’s default user. Take a look at Francisco Gaviria’s answer for more information. You can always get your connection information in AWS console -> connect -> SSH Client . It will show you the command with correct default user and ip and key.

On windows, you probably want to use putty to connect. You can also use Mobaxterm or similar softwares

Because you must use:

ssh -i Your.pem DefaultUserName@YourPublicServerIP

And:
For Amazon Linux 2 or the Amazon Linux AMI, the user name is ec2-user.

Verify if you are using ec2-user how your default user

For others OS

Ubuntu AMI, the user name is ubunt.  
CentOS AMI, the user name is centos.
Debian AMI, the user name is admin.
Fedora AMI, the user name is ec2-user or fedora.
SUSE AMI, the user name is ec2-user or root.
RHEL AMI, the user name is ec2-user or root.  
CJ

Also please make sure your key has correct premissions

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?