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 johndoe@my.ip.address:~/

and I was prompted for password:

johndoe@my.ip.address'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 root

and 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...

  • You need to give the password of johndoe on the machcine my.ip.address. – terdon Sep 23 '16 at 17:08
  • @terdon: is it the one setup by passwd? Tried but doesn't work – Francis Sep 23 '16 at 17:15
  • No, your sudo passwd root command sets root's password, you want johndoe's. Have you tried logging in as johndoe and simply running passwd? – terdon Sep 23 '16 at 17:22
  • @terdon: Yes, in fact that's the first thing I tired. – Francis Sep 23 '16 at 17:28
  • 1
    Then please edit your question and tell us so. – terdon Sep 23 '16 at 18:16

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 windows.user.name@my.ip.address

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.