I am trying to connect AWS and I am getting the following error:
Permission denied (publickey).
The only things I have are:
- User Name
- Host
- a 20 char Key
I am running the command ssh -i <KEY> user@host
I am trying to connect AWS and I am getting the following error:
Permission denied (publickey).
The only things I have are:
I am running the command ssh -i <KEY> user@host
Perform below steps,
sudo chmod 400 <KEY-NAME>.pem
sudo ssh -i "<KEY-NAME>.pem" <username>@<host>
Make sure username is right one as username can be root, ec2-user, ubuntu etc.
if it doesn't solve your issue then please share information with debugger by running ssh command with -vv.
sudo ssh -i "<KEY-NAME>.pem" <username>@<host> -vv
For me editing the ssh configuration file and changing PasswordAuthentication no
to PasswordAuthentication yes
worked. So just type:
sudo vim /etc/ssh/sshd_config
Edit the file and then restart ssh service:
sudo service ssh restart
Then you will able to login with any created user without using the pen certificate that is only intended to login as ubuntu user (i.e. similar to root).