Suddenly can't login to filezilla with EC2 amazon server - amazon-web-services

I have a free EC2 Amazon Ubuntu server and I was connected with putty and filezilla and I was transferring files. Suddenly I lost connection and now whenever I login on either putty of filezilla I get and error saying
Disconnected: No supported authentication methods available (server sent: publickey)
Any ideas what could be possibly happening? I think that before this happened I change the permissions of a folder. Don't know if that's relevant.

I think that before this happened I change the permissions of a
folder. Don't know if that's relevant
Did you change the permission of ~/.ssh directory? ssh expects the directory to have 700 as permission and the ~/.ssh/authorized_key file to have 600 permission. Do you remember what exactly you changed?
You are out of luck if you changed the permissions of ~/.ssh folder. There are other convoluted ways to restore access. You have to stop the instance, attach the root partition to another instance, then change the folder permission, detach the partition, attach it back to your original instance and start it. Search StackOverflow for answers.

Related

Is there a way to restore access to EC2 instance when SSH key gives error?

My AWS account was suspended when my credit card expired and I updated the card in an hour. The access to my account was restored. But when I started my EC2 server, and tried to connect with SSH it gave an error saying Key not recognised.
I tried to follow the steps provided by AWS support to attach my volume to another server, reset the SSH permissions and re-attach volume to my original server. But on attaching volume to new server and mounting it, I found that the user directory (/home/ubuntu) was missing along with the /var/www directory from apache 2. So I have been unable to reset the SSH access.
Can anyone help with this?

Getting SSL to work in AWS on Ghost by bitnami

I am stuck on step 4 with using SSH to enable https
https://docs.bitnami.com/aws/how-to/configure-elb-ssl-aws/
I open putty to make an SSH
I type /opt/bitnami/apps/ghost/conf/httpd-prefix.conf
the SSH client tells me -bash:/opt/bitnami/apps/ghost/conf/httpd-prefix.conf: permission denied
Can anyone provide a more detailed instruction into how to get my SSL certificate to work with Ghost by bitnami on AWS
Thank you
There's two things you need to do. First, you have to launch an editor to modify the httpd-prefix.conf file. Nano is easy to use and should be installed on your instance already. Issue a command like nano /opt/bitnami/apps/ghost/conf/httpd-prefix.conf, make your edits in the nano editor, then save the file.
The second thing is to make sure that the account you are using has permissions to perform those tasks. You'll need root-level permissions. You can use the sudo command to run things as root. If you get a permission denied error when launching nano, try sudo nano /opt/bitnami/apps/ghost/conf/httpd-prefix.conf and enter the necessary password to execute the nano command with root privileges.
Keep in mind that the best practice for AWS accounts is to only use the root account to create your first IAM user, so that your root account credentials stay safe, and that hackers can't gain full control of your account should a compromise happen.
Instead try this for setting up an SSL cert https://docs.bitnami.com/aws/how-to/generate-install-lets-encrypt-ssl/

Unable to SSH into my EC2 instance from a different computer

A little backstory, I have an AWS instance made with Bitnami that I set up on my Windows Machine back home. I am currently out of the country and have no way to access that machine at the moment. One month later, I visit the website getting a 500 error and (only my Macbook on me). I've tried to SSH into it from my Macbook and no luck. I get the error:
Username is not in the sudoers file. This incident will be reported.
I've also tried another way to SSH into my aws but then I just get
Permission denied (publickey).
I do have the public/private keys I made with me so I am not sure if I had to set up some additional permissions to SSH from a different computer. On top of that, I got an email stating that someone attempted to access remote hosts on the internet without authorization. If I visit my Public IP address of my instance, it goes straight to a spam page.
At this point, I am not sure if I am just missing something in my steps or have missed a step. If someone can help me, I would really appreciate it.
Is there some way to get my instance back up and running? If not, is there some way I can back up the wordpress files on that instance that's down and use it to create another one on my Macbook currently? Please let me know.
If you have the private key that your AWS instance has been installed with, place the key in ~/.ssh .
Then, run the following command to set the permissions of the key to read and write only to your user (it's a mandatory step):
chmod 600 ~/.ssh/keyname
Then, run the following command to connect to your instance:
ssh -i ~/.ssh/keyname user#instance_ip
And it should connect successfully.
If you're not sure which user to connect to and you have access to AWS EC2 Console, then look for that server, right-click it and choose "Connect" and it will usually show the correct user to use when connecting to it by SSH.

Can't change permissions to upload to EC2

I read over two hours for solutions but now post my question.
I only need to update one single file on an AWS EC2 (centos server) and always have used FileZilla to do so but in the "/var/www/web/app" folder I am not allowed to upload any files.
I also am not allowed to change any folder permissions. I have only very little knowledge in using a terminal or putty and EC2. How can I upload this one single file to EC2? The online terminal which can be used in EC2 (under "Connect") does not open aswell. I start to pull my hair. I only need to upload this one file because I had to change one single line of code.
Your user has insufficient privileges to make filesystem changes.
You need to log in as the root user using the superuser account and password, which the owner of the EC2 hopefully has.
How did this code get onto the EC2 in the first place if it wasn't placed there by you?

Cannot access Amazon EC2 instance after changing sshd_config file (deadlock)

I was trying to access Amazon EC2 instance without using keypairs (I was doing some tests with Dreamweaver)
So, I had a marvelous ideia of changing sshd_config file.
sudo nano /etc/ssh/sshd_config
And I change the PasswordAuthentication line to:
Match User ubuntu
PasswordAuthentication yes
After restarting I got a sad surprise. I cannot access my machine anymore. And even worst I had only one user (ubuntu) on this instance.
My question is:
How can I back to original setting ( roolback sshd_config file) if I cannot access my terminal?
Loosing access to an Amazon EC2 instance is a common encounter - how to approach this situation when you don't know the reason yet is addressed in Eric Hammond's excellent summary Solving: "I can't connect to my server on Amazon EC2".
However, since you already now that the problem is permission related, you can apply his respective instructions Fixing Files on the Root EBS Volume of an EC2 Instance right away, see my answer to the related question Fixing Amazon EC2 Permissions for a short summary of this approach.
Good luck!