I am using scp to upload files from local to ec2, and I got the permission error.
Permission denied (publickey).
lost connection
How do i fix this?
You need to get your ssh keys uploaded.
Here's a link to an article showing you how to set this up:
http://alestic.com/2010/10/ec2-ssh-keys
Also, see this:
AWS ssh access 'Permission denied (publickey)' issue
Related
I have a AWS Lightsail Bitnami instance. I am able to ssh using the default keypair. However when I try to scp using that same key I am given a 'Permission denied' response. I have tried scp'ing to /home/bitnami/apps/ and /opt/bitnami/apps. I have also tried changing the permissions of my pem file to 400.
scp -r -i lightsail-key.pem ~/Local\ Sites/myportfolio/app/ bitnami#34.170.81.72:/opt/bitnami/apps
I needed to change the owner of the target folder. I ssh'd into my instance and ran sudo chown bitnami TARGETFOLDER.
I have instance id, public DNS IP address, .pem file. I tried to connect to an EC2 instance using FileZilla but each time it fails saying could not authenticate (server: public key sent).
How can I connect using filezilla to EC2 instance?
I have tried putty too but it also gives an error and can't let me log in.
When tried using command line ssh -i My.pem root#ec2-myipaddress.us-west-2.compute.amazonaws.com it also gives error Permission denied (public key).
ssh -i My.pem root#ec2-myipaddress.us-west-2.compute.amazonaws.com
Its give permission issue so first of all run below command
sudo chmod 400 My.pem
After that try to connect with ssh command
and for file transfer use winSCP Tool.
you can check here for more detail
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html
Thanks
So, I just do trial GCloud service, and try connect via ssh. At the first time I forget my username of my Mac, so I did it wrong by doing this:
doe-MacBook-Pro:Documents does$ ssh -i ~/.ssh/google_compute_engine xxxx#111.111.111.111
Warning: Identity file /Users/does/.ssh/google_compute_engine not accessible: No such file or directory.
The authenticity of host '111.111.111.111 (111.111.111.111)' can't be established.
ECDSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxx.
Are you sure you want to continue connecting (yes/no)? y
Please type 'yes' or 'no': yes
Warning: Permanently added '111.111.111.111' (ECDSA) to the list of known hosts.
Permission denied (publickey).
then I know my username, I tried:
doe-MacBook-Pro:Documents does$ ssh -i ~/.ssh/google_compute_engine does#111.111.111.111
Warning: Identity file /Users/does/.ssh/google_compute_engine not accessible: No such file or directory.
Permission denied (publickey).
and it gives me error. Can you tell me how can I solve this issue?
This has nothing to do with the ssh username.
Check two things first and we can go from there:
Permission: should be readable by you, i.e., at least 0400.
File: does it exist at all?
Problem SOLVED!
I forget didn't completed my gcloud compute ssh project-name command.
After I finished with the command, it creates file google_compute_engine.
Now I finally can connect to my Google Cloud via SSH.
this is probably a simple stupidly question :)
I've created a new windows instance on Amazon EC2, and also downloaded the .pem file to SSH.
with cygwin
$ ssh -i mykey.pem Administrator#ec2-xx-xx-xx-xxx.us-west-2.compute.amazonaws.com
Administrator#ec2-xx-xx-xx-xxx.us-west-2.compute.amazonaws.com's password:
Permission denied, please try again.
permission set to 400 for mykey.pem file.
$ chmod 400 mykey.pem
I also tired with the putty by creating mykey.ppk file form mykey.pem with puttygen but getting access denied error :(
Using username "Administrator".
Authenticating with public key "imported-openssh-key"
Server refused public-key signature despite accepting key!
Administrator#ec2-xx-xx-xx-xxx.us-west-2.compute.amazonaws.com's password:
Access denied
dont know what kind of silly mistake im making here!
Please guys do u have any suggestion here?
Following are the most possible reasons-
Port 22 is not open while creating EC2 instance
Firewall configuration on your local machine(just try disconnecting VPN)
AWS account is suspended due to pending bill payment
SSH port on EC2 server were not open to incoming traffic.
How to I grant myself permission to transfer a .crt file from my local machine to the aws ubuntu 12.04 server?
I am using the following command from my machine and receiving a permission denied response.
scp -i /Users/me/key_pair.pem /Users/me/ssl-bundle.crt ubuntu#ec2-50-150-63-20.eu-west-1.compute.amazonaws.com:/etc/ssl/certs/
I am following comodo's instruction. Refer to the heading Configure your nginx Virtual Host from the link. I have not set anything up with regards to permission as user. This is a little new to me and will appreciate further sources of information.
I changed the permission of the path on the server and transferred the file!
With reference to File Permissions , I gave the /etc/ssl/certs/ path the "Add other write & execute" permission by this chmod command when ssh'd into the Ubuntu server:
sudo chmod o+wx /etc/ssl/certs/
Then, on my local machine, the following command copied a file on my directory and transferred it to destination:
scp -i /Users/me/key_pair.pem /Users/me/ssl-bundle.crt ubuntu#ec2-50-150-63-20.eu-west-1.compute.amazonaws.com:/etc/ssl/certs/
It is the write permission you need, and depending on your use case, use the appropriate chmod command.
Simplest way to transfer files from local to ec2 (or) ec2 to local by FileZila.
You can connect with your instance by using Filezila, then transfer files from local to server and vice-versa.