mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
commit
a9ffbe162e
@ -1,112 +0,0 @@
|
||||
[#]: subject: "Transfer files and folders from Windows to Linux with WinSCP"
|
||||
[#]: via: "https://opensource.com/article/22/11/transfer-files-folders-windows-linux-winscp"
|
||||
[#]: author: "Paul https://opensource.com/users/plaubscher"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "robsean"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Transfer files and folders from Windows to Linux with WinSCP
|
||||
======
|
||||
|
||||
If you're looking for a way to quickly transfer files from your Windows computer to your Linux computer, then the open source WinSCP utility makes it easy to transfer a file or a folder of files over the network.
|
||||
|
||||
Sometimes you need to transfer files over a network. There are lots of file sharing services out there, but most require that you send your file to the Internet. This seems like a long way to go (not to mention the privacy concerns) when two computers are right beside each other, or at least in the same building. The open source WinSCP utility makes it quick and easy to transfer a file or a folder of files over the network from your Windows computer to your Linux computer.
|
||||
|
||||
### IP address
|
||||
|
||||
Before you can make the transfer, you must know the IP address or fully-qualified domain name of the destination computer. Assuming it's a computer on your same network, and that you're not running a DNS server to resolve computer names, you can find the destination IP address using the `ip` command on the Linux machine:
|
||||
|
||||
```
|
||||
[linux]$ ip addr show |grep'inet '
|
||||
inet 127.0.0.1/8 scope host lo
|
||||
inet 192.168.1.23/24 brd 10.0.1.255 scope global noprefixroute eth0
|
||||
```
|
||||
|
||||
In all cases, 127.0.0.1 is a loopback address that the computer uses only to talk to itself, so in this example the correct address is 192.168.1.23. On your system, the IP address is likely to be different. If you're not sure which is which, you can try each one in succession until you get the right one (and then write it down somewhere!)
|
||||
|
||||
Alternatively, you can look in your router's settings, which list all addresses assigned over DHCP.
|
||||
|
||||
### Firewalls and servers
|
||||
|
||||
The `WinSCP` command uses the OpenSSH protocol, so your Linux computer must be running the OpenSSH server software, and its firewall must allow SSH traffic.
|
||||
|
||||
If you're not sure whether your Linux machine is running SSH, then run this command on the Linux machine:
|
||||
|
||||
```
|
||||
[linux]$ sudo systemctl enable--now sshd
|
||||
```
|
||||
|
||||
To ensure your firewall allows SSH traffic, run this command:
|
||||
|
||||
```
|
||||
[linux]$ sudo firewall-cmd --add-servicessh--permanent
|
||||
```
|
||||
|
||||
For more information on firewalls on Linux, read [Make Linux stronger with firewalls][1].
|
||||
|
||||
### Using WinSCP
|
||||
|
||||
WinSCP is an open source SSH file transfer application for Microsoft Windows. To use it, you first must [download and][2][install][2] it.
|
||||
|
||||
Once you're installed it, open WinSCP and select the **SCP** option in the **File Protocol** field.
|
||||
|
||||
Add the IP address or DNS name of your Linux computer in the **Host name** field, and enter **22** in the **Port number** field. Enter you user name and password for the Linux computer, and then click the **Login** button at the bottom of the WinSCP window.
|
||||
|
||||
![Image of the WinSCP login window.][3]
|
||||
|
||||
Verify that you are authenticated to the Linux computer. Upon success, your Linux computer's IP address or DNS name appears at the top of the window.
|
||||
|
||||
![Image of a WinSCP window showing where IP adress is located.][4]
|
||||
|
||||
Now you can drag and drop a file (I used `winscp-test.txt` as an example) from the left Windows pane to the destination Linux computer pane on the right, and the file transfers.
|
||||
|
||||
![Image of drag and drop window in WinSCP.][5]
|
||||
|
||||
Alternatively, you can right-click on a file in the left pane and upload it to the remote destination in the right pane.
|
||||
|
||||
![Image of a right click option to upload files in WinSCP.][6]
|
||||
|
||||
### Verify the copy
|
||||
|
||||
Open a Linux terminal and use the `ls` command to view the transferred `winscp-test.txt` file. In my example, it appears in my home directory, `/_home_/sysadmin`.
|
||||
|
||||
```
|
||||
$ ls
|
||||
Desktop
|
||||
Documents
|
||||
Downloads
|
||||
Music
|
||||
Pictures
|
||||
pscp-test.txt[...]
|
||||
```
|
||||
|
||||
You've successfully transferred a file from a Windows computer to a Linux computer over the network!
|
||||
|
||||
Of course, you can use the same technique as above to transfer files and folders from a Linux computer to a Windows computer.
|
||||
|
||||
### Remote copying
|
||||
|
||||
With the power of the open source WinSCP application, you have access to any computer in your house or workplace, to servers you have accounts on, and even mobile, [edge][7], and Internet of Things devices. Use this great tool to transfer files as easily as you would copy a file from one local directory to another!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/11/transfer-files-folders-windows-linux-winscp
|
||||
|
||||
作者:[Paul][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/plaubscher
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/19/7/make-linux-stronger-firewalls
|
||||
[2]: https://sourceforge.net/projects/winscp/files/
|
||||
[3]: https://opensource.com/sites/default/files/2022-10/winscp.loginwindow.png
|
||||
[4]: https://opensource.com/sites/default/files/2022-10/WinSCPwindow.showing.IPinfo.png
|
||||
[5]: https://opensource.com/sites/default/files/2022-10/WinSCP.drapdropwindow.png
|
||||
[6]: https://opensource.com/sites/default/files/2022-10/RightclickUploadfileWInSCP.png
|
||||
[7]: https://www.redhat.com/en/topics/edge-computing/what-is-edge-computing?intcmp=7013a000002qLH8AAM
|
@ -0,0 +1,112 @@
|
||||
[#]: subject: "Transfer files and folders from Windows to Linux with WinSCP"
|
||||
[#]: via: "https://opensource.com/article/22/11/transfer-files-folders-windows-linux-winscp"
|
||||
[#]: author: "Paul https://opensource.com/users/plaubscher"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "robsean"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
使用 WinSCP 将文件和文件夹从 Windows 传输到 Linux
|
||||
======
|
||||
|
||||
如果你正在寻找一种快速的从你的 Windows 计算机传输文件到你的 Linux 计算机的方法,那么开源的 WinSCP 实用程序会使其很容易地通过网络传输一个文件或一个文件夹。
|
||||
|
||||
有时,你需要通过文件传输文件。这里有很多文件共享服务,但是大多数的共享服务都要求你发送你的文件到互联网上。当两台计算机并排在一起或在一栋建筑物中时,通过互联网传输文件,这似乎看起来是一条很长的路 (更不用说隐私问题)。开源 WinSCP 实用程序会使其很轻易地通过网络将一个文件或一个文件夹从你的 Windows 计算机传输到你的 Linux 计算机。
|
||||
|
||||
### IP 地址
|
||||
|
||||
在你可以传输之前,你必需知道目标计算机的 IP 地址或完全限定的域名。假设它是一台在你的同一个网络上的计算机,并且你没有运行一个 DNS 服务器来解析计算机名称,你可以在 Linux 计算机上使用 `ip` 命令来找到目标 IP 地址:
|
||||
|
||||
```
|
||||
[linux]$ ip addr show |grep'inet '
|
||||
inet 127.0.0.1/8 scope host lo
|
||||
inet 192.168.1.23/24 brd 10.0.1.255 scope global noprefixroute eth0
|
||||
```
|
||||
|
||||
在所有的情况下,127.0.0.1 都是一个 <ruby>回送地址<rt>loopback address</rt></ruby> ,计算机仅使用它来自我通信,因此在这个示例中,正确的地址是 192.168.1.23 。在你的系统中,IP 地址可能会看起来有所不同。如果你不确定哪个是哪个,你可以逐个尝试到你找到正确的 IP 地址 (然后,在一些地方写下来!)
|
||||
|
||||
或者,你可以查找你的路由器设置,它列出了所有通过 DHCP 分配的地址。
|
||||
|
||||
### 防火墙和地址
|
||||
|
||||
`WinSCP` 命令使用 OpenSSH 协议,因此,你的 Linux 计算机必需运行 OpenSSH 服务器软件,并且你的 Linux 计算机的防火墙必需允许 SSH 通信。
|
||||
|
||||
如果你不确定你的 Linux 机器是否在运行 SSH ,那么在 Linux 机器的终端上运行这个命令:
|
||||
|
||||
```
|
||||
[linux]$ sudo systemctl enable--now sshd
|
||||
```
|
||||
|
||||
为确保你的防火墙允许 SSH 通信,运行这个命令:
|
||||
|
||||
```
|
||||
[linux]$ sudo firewall-cmd --add-servicessh--permanent
|
||||
```
|
||||
|
||||
关于 Linux 上的防火墙的更多信息,阅读 [增强 Linux 防火墙][1] 。
|
||||
|
||||
### 使用 WinSCP
|
||||
|
||||
WinSCP 是一款针对 Microsoft Windows 的开源 SSH 文件传输应用程序。为使用它,你必需先 [下载][2] 和 [安装][2] 它。
|
||||
|
||||
在你安装完成后,打开 WinSCP ,并在 <ruby>文件协议<rt>File Protocol</rt></ruby> 区域中选择 **SCP** 选项。
|
||||
|
||||
在 <ruby>主机名称<rt>Host name</rt></ruby> 区域中添加你的 Linux 计算机的 IP 地址或 DNS 名称,并在 <ruby>端口编号<rt>Port number</rt></ruby> 区域中输入 **22** 。针对该 Linux 计算机,输入你的用户名称和密码,然后单击 WinSCP 窗口底部的 <ruby>登录<rt>Login</rt></ruby> 按钮。
|
||||
|
||||
![Image of the WinSCP login window.][3]
|
||||
|
||||
验证你是否获取登录 Linux 计算机的身份授权。在验证成功后,你的 Linux 计算机的 IP 地址或 DNS 名称将显示在窗口的顶部。
|
||||
|
||||
![Image of a WinSCP window showing where IP adress is located.][4]
|
||||
|
||||
现在,你可以从左侧的 Windows 面板中拖拽一个文件 (如示例,我使用 `winscp-test.txt` 文件) 到右侧的目标 Linux 计算机目标,接下来文件或传输。
|
||||
|
||||
![Image of drag and drop window in WinSCP.][5]
|
||||
|
||||
或者,你可以在左侧的面板中右键单击一个文件,然后上传它到右侧的远程目标的面板。
|
||||
|
||||
![Image of a right click option to upload files in WinSCP.][6]
|
||||
|
||||
### 验证复制件
|
||||
|
||||
打开一个 Linux 终端,然后使用 `ls` 命令来查看已传输的 `winscp-test.txt` 文件。在我的示例中,它出现在我的 home 目录, `/_home_/sysadmin` 。
|
||||
|
||||
```
|
||||
$ ls
|
||||
Desktop
|
||||
Documents
|
||||
Downloads
|
||||
Music
|
||||
Pictures
|
||||
pscp-test.txt[...]
|
||||
```
|
||||
|
||||
你已经通过网络成功地将一个文件从一台 Windows 计算机传输到一台 Linux 计算机!
|
||||
|
||||
当然,你也可以使用类似上述的技术,将文件和文件夹从一台 Linux 计算机传输到一台 Windows 计算机。
|
||||
|
||||
### 远程复制
|
||||
|
||||
使用强大的开源 WinSCP 应用程序,你可以访问在你家中或工作场所的任意一台计算机、你拥有账户的服务器、甚至是移动设备、[边缘设备][7]、物联网设备。使用这个极好的工具来传输文件就像你在本地目录下将一个文件复制到另一个本地目录一样容易!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/11/transfer-files-folders-windows-linux-winscp
|
||||
|
||||
作者:[Paul][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[robsean]](https://github.com/robsean)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/plaubscher
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://opensource.com/article/19/7/make-linux-stronger-firewalls
|
||||
[2]: https://sourceforge.net/projects/winscp/files/
|
||||
[3]: https://opensource.com/sites/default/files/2022-10/winscp.loginwindow.png
|
||||
[4]: https://opensource.com/sites/default/files/2022-10/WinSCPwindow.showing.IPinfo.png
|
||||
[5]: https://opensource.com/sites/default/files/2022-10/WinSCP.drapdropwindow.png
|
||||
[6]: https://opensource.com/sites/default/files/2022-10/RightclickUploadfileWInSCP.png
|
||||
[7]: https://www.redhat.com/en/topics/edge-computing/what-is-edge-computing?intcmp=7013a000002qLH8AAM
|
Loading…
Reference in New Issue
Block a user