[英]Unable to transfer local file wsl ubuntu terminal to remote server using windows subsystem
I have a file called test1.zip
in /mnt/c/Users/test/
folder of my local laptop [in which ubuntu windows subsystem for linux is installed].我在本地笔记本电脑的/mnt/c/Users/test/
文件夹中有一个名为test1.zip
的文件 [其中安装了用于 linux 的 ubuntu Windows 子系统]。 Local ubuntu terminal WSL name is lauda
本地 ubuntu 终端 WSL 名称为lauda
Now, I would like to transfer this zip file called test1.zip
to my remote server named stuff
.现在,我想将这个名为test1.zip
zip 文件test1.zip
到名为stuff
远程服务器。
PLEASE NOTE THAT ALL COMMANDS ARE TRIED FROM MY LOCAL LAPTOP WSL SCREEN [ubuntu screen]请注意,所有命令都在我的本地笔记本电脑 WSL 屏幕 [ubuntu 屏幕] 上尝试过
So, I tried the below command from my WSL [local laptop ubuntu WSL terminal]所以,我从我的 WSL [本地笔记本电脑 ubuntu WSL 终端] 尝试了以下命令
scp user1@lauda:/mnt/c/Users/test/test1.zip user1@stuff:/home/test/codes/test1
and got the error ssh: Could not resolve hostname lauda: Name or service not known
并收到错误ssh: Could not resolve hostname lauda: Name or service not known
So I tried the below [replacing the lauda
local laptop ubuntu terminal hostname with its IP]所以我尝试了下面的 [用它的 IP 替换lauda
本地笔记本电脑 ubuntu 终端主机名]
scp user1@172.xx.xxx.xxx:/mnt/c/Users/test/test1.zip user1@stuff:/home/test/codes/test1
this resulted in error as ssh: connect to host 172.xx.xxx.xxx port 22: Connection refused
这导致错误为ssh: connect to host 172.xx.xxx.xxx port 22: Connection refused
Now I tried the same command as above but in opposite way as shown below现在我尝试了与上面相同的命令,但以相反的方式如下所示
scp user1@stuff:/home/test/codes/ user1@lauda:/mnt/c/Users/test/test1.zip
and got the below error并得到以下错误
ssh: Could not resolve hostname lauda: Temporary failure in name resolution
Later, I tried with IP address后来,我尝试使用IP地址
scp user1@stuff:/home/test/codes/ user1@172.xx.xxx.xxx:/mnt/c/Users/test/test1.zip
And I got the below error我得到了以下错误
ssh: connect to host 172.xx.xxx.xxx port 22: No route to host lost connection
Later, I tried the below commands as well后来,我也尝试了以下命令
scp /mnt/c/Users/test/test1.zip user1@stuff:/home/test/codes/
and got an error scp: /home/test/codes/test1.zip: Permission denied
并得到一个错误scp: /home/test/codes/test1.zip: Permission denied
So, I again tried like below所以,我再次尝试如下
scp user1@stuff:/home/test/codes/ /mnt/c/Users/test/test1.zip
and got an error scp: /home/test/codes: not a regular file
并得到一个错误scp: /home/test/codes: not a regular file
PLEASE NOTE THAT ALL COMMANDS ARE TRIED FROM MY LOCAL LAPTOP WSL SCREEN [ubuntu screen]请注意,所有命令都在我的本地笔记本电脑 WSL 屏幕 [ubuntu 屏幕] 上尝试过
How can I transfer local files/folders from my local ubuntu WSL terminal to remote server?如何将本地文件/文件夹从本地 ubuntu WSL 终端传输到远程服务器?
scp /mnt/c/Users/test/test1.zip user1@stuff:/home/test/codes/
is the closest attempt to working. scp /mnt/c/Users/test/test1.zip user1@stuff:/home/test/codes/
是最接近工作的尝试。 The error you get could be due to one of two reasons:您得到的错误可能是由于以下两个原因之一:
Firstly user1
does not have permissions to write to /home/test
on stuff
- makes sense as usually only the test
user would be able to write there.首先, user1
没有权限写入/home/test
的stuff
- 通常只有test
用户才能在那里写入是有道理的。 (Note that the test
user on your WSL instance is not the same profile the test
user on the remote.) (请注意, test
你的WSL实例用户是不一样的配置文件中的test
遥控器上的用户。)
Secondly the /home/test/codes/
folder may not even exist yet.其次, /home/test/codes/
文件夹甚至可能还不存在。
Instead (if you know test
's password) copy as the test
user :相反(如果您知道test
的密码)复制为test
用户:
scp /mnt/c/Users/test/test1.zip test@stuff:/home/test/codes/
Or copy to user1
's home directory (after ensuring you have created /home/user1/codes/
或者复制到user1
的主目录(确保你已经创建了/home/user1/codes/
scp /mnt/c/Users/test/test1.zip user1@stuff:/home/user1/codes/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.