Unable to access instance Permission denied (publickey) after installing vsftpd - amazon-web-services

I am unable to access my ec2 ssh , the last thing i am sure that i've did is created AMI in aws console and then installed vsftpd:-
sudo apt install vsftpd
That's it.
Now when i am trying to access ec2 ssh i get the following error:-
ssh -i sshkey.pem ubuntu#ec2-00-000-000-000.eu-west-3.compute.amazonaws.com
ubuntu#ec2-00-000-000-000.eu-west-3.compute.amazonaws.com: Permission denied (publickey).
How can i fix this?

Installing vsftpd can never have an impact on your SSH access.
the only things I think of:
you regenerated ssh keys for ubuntu user.
you rebooted your ec2 server and with elatic IP attached and now it has a different IP.
your ssh key has wrong permissions, it should be 600

Related

Permission Denied (Public Key) EC2

I'd like to ask you for assistance on this. It is the first time I'm trying
to ssh into EC2 instance from my laptop. I've got pem file with permission bits set to 400 in ~/.ssh
The instance is up and running and my attempt is:
ssh -i ~/.ssh/app-prod.pem coding_hedgehog#ec2-1-7-6-51.eu-west-2.compute.amazonaws.com
output:
coding_hedgehog#ec2-1-7-6-51.eu-west-2.compute.amazonaws.com: Permission denied (publickey)
I'm following this article but nothing seems to work in my case. coding_hedgehog is my IAM and it is displayed when I'm logged into AWS console so the problem can't be using wrong IAM nick.
The EC2 instance runs Ubuntu 20.04
Some tutorials show that using ubuntu#public_dns will work. I get the same error though.
Security Group inbound rules:
Instructions to connect via ssh:

How to create ansible master on GCP VM instance?

I tried to create ansible master on instance-1 in GCP. And I have an application instance-2. When I try to connect from instance-1 to instance-2 I always get error message - Permission denied (publickey).
I added instance-2 ssh public key to authorized_keys and configured parameter PasswordAuthentication to yes in sshd_config. In ansible file I have this:
sba ansible_host=35.**.57.** ansible_user=admin
ansible_ssh_private_key_file=/home/admin/.ssh/app_gcp
Also I can't do sudo ssh-copy-id 35.111.57.111
The problem was in wrong ansible_ssh_private_key_file. It should point on the id_rsa of the current machine.

Trying to connect to RDS instance through my ec2 instance from my local machine and coming up with the following error

Tried connecting to the rds instance through the ec2 instance from and my local machine coming up with an error saying "Permission denied (public key)"
ssh -L 3306:db_instance_name.cxtitvmupc3w.us-west-2.rds.amazonaws.com:3306 my_instance_ip
Permission denied(public key)
This is ssh saying that you have not provided a private key to establish the ssh session.
You would normally include -i keyfile.pem in the command, exactly the same way you would normally ssh to the instance.

AWS ssh into instance giving Permission denied (publicly)

I am trying to ssh into a new EC2 instance. I have followed the instructions and when I attempt to ssh I get Permission denied (publickey).
Below is an image of everything I did in the console according to the instructions. Everything seems to go accordingly until I enter yes. Then it fails. I have followed the instructions twice and get the same result. I also do not have AWS CLI Tools as I believe they are optional.
ssh will use your local username to connect to the instance by default, if you not specified Host, User and IdentityFile in your ~/.ssh/config.
As you call ssh to your instance with the pem specified on the command line you also have to specify the remote user name (which is ec2-user for AWS linux instances and ubuntu for AWS Ubuntu instances).
Try to use this commandline:
ssh -i sub_api.pem ec2-user#ec2-54....

AWS OpsWorks SSH Connect directly permission denied (publickey)

From AWS OpsWorks SSH instructions, connect directly section (ssh from Terminal):
Directly connect to the instance using your terminal application.
ssh://foobar#1.2.3.4
I just copied the ssh url and tried but got permission denied:
> ssh ssh://foobar#1.2.3.4
Permission denied (publickey).
Why?
Do not need to specify the protocol, just do:
ssh foobar#1.2.3.4