1

I read many similar questions on stackoverflow and StackExchange. But I still failed to use scp to transfer files from linux to window.

scp -r need_transfer_dir -P port username@ip:destination_directory
  1. First, I used scp to transfer files from window to linux, it was successful.
  2. I have also succeeded in transferring files from this linux server to other linux servers.
  3. I can use Xftp to successfully exchange files on my windows computer and linux server, but I have to open the Xftp software every time, and I want to use scp command line to transfer files.
  4. I transfer files from the linux server to my windows computer, but after various attempts, I have not succeeded.

I don't know which step has the problem

The process I tried is as follows: 1.I check the ip address of my windows computer. Open cmd. Type ipconfig enter image description here So my ip address is the line beginning with 10. in the figure().

  1. I check my username. But I don't know how to find it on the window. I tried the following methods. (1). Open cmd. Type whoami the result is : desktop-7l9s7rg\user (2) Open git Bash. Type whoami the result is : User (3) Open the account settings of the window account, as shown in the figure below, my email is displayed. enter image description here

  2. I tried the following command line.

    scp -P 22  -r diff_work  [email protected]:/c:/
    scp -P 22  -r diff_work  desktop-7l9s7rg\[email protected]:/c:/
    scp -P 22  -r diff_work  [email protected]:/c:/
    
    scp -r diff_work  [email protected]:/c:/
    scp -r diff_work  desktop-7l9s7rg\[email protected]:/c:/
    scp -r diff_work  my_email\[email protected]:/c:/

But none of them worked. Can anyone help me see what went wrong. Or how to find the error? thank you very much!

4
  • You may have censored the IP in the screenshot, but apparently not in the "command attempts"? Doesn't matter much anyways, as it's a local one.
    – Panki
    Commented Jul 4, 2021 at 14:07
  • 1
    Your attempt with desktop-7l9s7rg\[email protected]:/c:/ seems to be most promising - please edit your question and include the error message you are actually getting.
    – Panki
    Commented Jul 4, 2021 at 14:08
  • In the command line, I used the ip10.1.30.253 that I found. After executing the command, it has been stopped. After a long time, it displays ssh: connect to host 10.1.30.253 port 22: Connection timed out lost connection
    – Yujie
    Commented Jul 4, 2021 at 14:18
  • Does your Windows machine have an ssh server installed and enabled? Commented Jul 4, 2021 at 17:00

1 Answer 1

1

Make sure you have an SSH server installed on your Windows machine. Right now it sounds like you only have an SSH client on Windows, which will allow Windows to connect to other machines running an SSH server, but doesn’t do anything about those other machines connecting to your Windows machine.

You can transfer from Windows to Linux right now because, out of the box, many Linux distros have openssh-server installed and enabled. Windows typically only has a client, not a server.

Here’s a Microsoft article on installing OpenSSH on Windows: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse

1
  • 1
    Thank you very much! As you said, there is only openssh-client on the window, no openssh-server
    – Yujie
    Commented Jul 5, 2021 at 1:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .