如何将文件从Windows本地计算机移动到Linux远程服务器

时间:2017-08-18 09:55:07

标签: linux windows ssh

我刚开始使用远程服务器。 我试图将一个文件从我的本地计算机(Windows 10)复制到Ubuntu服务器。我正在使用ssh和PuTTY。

我尝试做的是:
scp D:\USER\Desktop\test.txt username@server:home

我明白了:

ssh: Could not resolve hostname d: Name or service not known

所以我尝试了其他一些事情,例如:

scp Desktop/test.txt username@server:home

返回:

Desktop/test.txt: No such file or directory

当然,我桌面上有一个现有的文本文件test.txt。

我觉得我无法弄清楚如何格式化Windows路径......

1 个答案:

答案 0 :(得分:1)

假设D是您在语法上安装Windows的驱动器

scp D:\Users\YOURUSERNAME\Desktop\test.txt USERNAME@remoteserver:~/Desktop/test.txt

Windows路径的反斜杠是可以的,使用ssh远程服务器路径的正斜杠

如果您有可以连接到远程服务器的私钥,可以使用-i标志提供

scp -i ~/.ssh/privatekey.pem D:\Users\YOURUSERNAME\Desktop\test.txt USERNAME@remoteserver:~/Desktop/test.txt

如果ssh服务器的标准端口是另一个端口,那么它的标准端口将是22,而不是提供带有-p标志的端口,例如: -p 2222

仔细检查远程主机是否可以访问,例如使用nmap或zenmap并打开端口。祝你好运。

PS:通过pscp实用程序还可以使用Putty Secure Copy程序。您可以在命令提示符中单独从putty启动它

其语法也是本地Windows文件夹的正斜杠。

pscp c:/music.mp3 ubuntu@10.0.0.3:/home/ubuntu/Music

相关问题