I'm having a very strange issue. When I try to SSH into my linux instance using the following line, it works.

ssh -i "F:\Work\Thomas Final Site\Bhasha.pem" ec2-user@xx.xxx.xxx.xxx

But when I try to scp from the linux instance to my home machine running Windows 7 using the following line, I get the following error.

scp -i "F:\Work\Thomas Final Site\Bhasha.pem" -r ec2-user@xx.xxx.xxx.xxx:~/smart-two-site "F:\Work\smart-two"

Could not create directory '/home/User/.ssh'.
The authenticity of host 'xx.xxx.xxx.xxx (xx.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/User/.ssh/known_hosts).
Permission denied (publickey).

I can't understand why using the same public key I would be able to ssh into the instance, but not scp from it. I can also scp from my local machine to the linux instance, but when I try to scp from my linux instance to my local machine from my local machine it crashes.

Any ideas as to what and why this is happening?

有帮助吗?

解决方案

Use Filezilla in sftp protocol it should work. add ppk file to settings under sftp.

其他提示

General suggestion. The way you are running scp for coying files between Linux and windows box will never work. SCP will presume that the file-system on either side of the connection is Linux/unix based.

Instead, when you need to copy files between Linux and windows hosts, use some software like FileZilla, WinSCP OR BitWise ( and tons of others).

All these software have their own way of utilizing the .pem file which you would need to use for transferring file. Please read their respective manual.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top