scp (secure copy) to ec2 instance without password
I have an EC2 instance running (FreeBSD 9 AMI ami-8cce3fe5), and I can ssh into it using my amazon-created key file without password prompt, no problem.
However, when I want to copy a file to the instance using scp I am asked to enter a password:
scp somefile.txt -i mykey.pem root@my.ec2.id.amazonaws.com:/
Password:
Any ideas why this is happening/how it can be prevented?
I figured it out. I had the arguments in the wrong order. This works:
scp -i mykey.pem somefile.txt root@my.ec2.id.amazonaws.com:/
scp -i /path/to/your/.pemkey -r /copy/from/path user@server:/copy/to/path
scp -i ~/.ssh/key.pem ec2-user@ip:/home/ec2-user/file-to-copy.txt .
The file name shouldnt be between the pem file and the ec2-user string - that doesnt work. This also allows you to reserve the name of the copied file.
链接地址: http://www.djcxy.com/p/32436.html上一篇: 更改ec2实例的密钥对
下一篇: scp(安全复制)到ec2实例没有密码