0

I have two AWS EC" Ubuntu 16.04 instances.

One is a Chef workstation and the other is a Chef Server.

I want to copy the RSA private key file, chefadmin.pem, from the Chef server to the workstation using scp.

This is the command, that I’ve ran:

scp -i ~/.ssh/chef.pem ubuntu@ec2-34-254-180-207.eu-west-1.compute.amazonaws.com:/drop/chefadmin.pem ~/learn-chef/.chef/chefadmin.pem

This is the output from the command: Warning: Identity file /root/.ssh/chef.pem not accessible: No such file or directory.

The authenticity of host 'ec2-34-254-180-207.eu-west-1.compute.amazonaws.com (172.31.45.61)' can't be established.
ECDSA key fingerprint is SHA256:vx45A3HhOAJMxtqyMRndZ//H/YhI9jaWAaIb8fg1izY.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ec2-34-254-180-207.eu-west-1.compute.amazonaws.com,172.31.45.61' (ECDSA) to the list of known hosts.
Permission denied (publickey).

Any ideas?

  • I guess the server you're copying to requires public key access. So, it's a bit of a chicken-and-egg problem. You're copying the means to access that server but you can't do that yet. If you have access to the destination server, change the configuration in /etc/ssh/sshd_config to permit password access as well. Then restart the service using sudo service sshd restart. Hopefully, it'll now prompt you for a password. – Ray May 16 at 8:37
  • Are you perhaps trying to run the command as root, whereas the chef.pem file is in the ~/.ssh directory of your regular user? – steeldriver May 16 at 9:07
  • Hi, I have two instances in the same AZ in AWS. Both instances use the same key "chef.pem" I used the .ppk to login to the instance via Putty and now I am trying to use the copy command "scp" to copy the key off Server A onto Server B. I get permissioned denied. I don't have any password assigned to them, only using keys. Hope this makes sense. – Anthony O'Reilly May 21 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.