Merge pull request #27783 from lkxed/20221101-1-Transfer-files-and-folders-from-Windows-to-Linux-with-WinSCP

[手动选题][tech]: 20221101.1 ️ Transfer files and folders from Windows to Linux with WinSCP.md
This commit is contained in:
Xingyu.Wang 2022-11-02 10:28:22 +08:00 committed by GitHub
commit 7f893c30a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: " "
[#]: 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