Copy file from remote to local with Windows 10 Bash
I am trying to copy some files on a remote host to my local machine using Win 10 Bash Shell, due to security policies I can only do so from the remote, so I made sure local port is open, logged on to remote, and typed:
scp somefile :~/and I was prompted for password:
's password:which I don't have since I didn't setup any. Tried remote user's password, johndoe's user password (setup by logging in as johndoe and simply running passwd) and the Windows 10 password, none worked. Then I tried to supply a root password, since I don't have one already I ran
sudo passwd rootand was told that password updated successfully. However the next time I run the same command it simply asked for new UNIX password as if none exists. Also scp still won't work with this password. Now I am stuck...
1 Answer
Turns out scp was trying to connect to Windows 10 system directly, instead of the Linux subsystem; and that's why none of the passwords works, since user johndoe doesn't exist on my Windows system in the first place.
To resolve the issue, I installed OpenSSH for Windows. Then, instead of the Linux subsystem user name, I supplied my Windows user name (the one you get from typing whoami in Windows PowerShell or Command Prompt) to the command; scp still doesn't quite work (gave me lost connection error), but at least sftp does now:
sftp