使用私钥/公钥从 Windows 到 Linux 的 PSCP 文件 [英] PSCP file from Windows to Linux using private/public keys

查看:55
本文介绍了使用私钥/公钥从 Windows 到 Linux 的 PSCP 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用 PSCP 传输文件:

I can transfer file using PSCP:

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

但不使用公钥/私钥.

步骤如下:

  1. 使用 PuTTYgen 生成公钥和私钥.

  1. Generate public and private keys using PuTTYgen.

将公钥复制到远程服务器的authorized_keys

Copy the public key to authorized_keys of Remote Server

将私钥保存到 Windows 服务器中的 key.ppk

Save the private key to key.ppk in Windows server

然后

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

它给出了致命:网络错误:连接被拒绝"

It gives "Fatal: Network error: Connection refused"

有人可以帮忙吗?

推荐答案

使用以下代码:

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

注意私钥路径和私钥的引号应该是 .ppk 格式.

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

注意8022是端口号,P是大写.希望这会有所帮助.

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

这篇关于使用私钥/公钥从 Windows 到 Linux 的 PSCP 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆