PSCP file from Windows to Linux using private/public keys

 ̄綄美尐妖づ 提交于 2019-12-30 11:03:42

问题


I can transfer file using PSCP:

C:\>pscp -pw <password> -r -p <path of the file>  user@Server:<path file to stored>

But not using the public/private key.

Steps followed:

  1. Generate public and private keys using PuTTYgen.

  2. Copy the public key to authorized_keys of Remote Server

  3. Save the private key to key.ppk in Windows server

  4. Then

    C:\>pscp -i privatekey pathofthefile user@server:pathfiletostored
    

It gives "Fatal: Network error: Connection refused"

Can someone please help?


回答1:


Use the following code:

C:\>pscp -i "path\of\the\privatekey\privatekey.ppk" C:\temp\example_file.txt user@server:/path/file/to/be/stored

Note the quotes for the private key path and the private key should be in .ppk format.

The connection refused error may also be due to the wrong port. In that case, you need to mention the correct port by the following code :

C:\>pscp -i "path\of\the\privatekey\privatekey.ppk" -P 8022 C:\temp\example_file.txt user@server:path/file/to/be/stored

Note that 8022 is the port number and the P is uppercase. Hope this helps.



来源:https://stackoverflow.com/questions/35292681/pscp-file-from-windows-to-linux-using-private-public-keys

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!