WSL icon indicating copy to clipboard operation
WSL copied to clipboard

SSH cannot see files copied using 'cp' from windows

Open Codemaverick opened this issue 10 years ago • 2 comments

I made the title as specific as possible because I know there are already a few issues (https://github.com/Microsoft/BashOnWindows/issues/44) and (https://github.com/Microsoft/BashOnWindows/issues/45) relating to bash seeing files copied using explorer into the Ubuntu file system (AppData/lxss).

I ran into that issue, and then decided to copy over some of my previous ssh keys using 'cp' from inside bash. Still, when I attempt to load they keys into the ssh-agent, it tells me the file does not exist even though they show up using the 'ls' command.

Codemaverick avatar Apr 10 '16 16:04 Codemaverick

Thank you for making the title specific.

Here's what I normally do (and what always works for me). Please tell me what you're doing different.

Setup:

  • Windows: ssh keys under /mnt/c/users/russalex/.ssh/ (russ_rsa and russ_rsa.pub)
  • Bash: Want keys under ~/.ssh/ Commands
russ@RUSSALEX-DESK:~$ mkdir ~/.ssh
russ@RUSSALEX-DESK:~$ cd ~/.ssh
russ@RUSSALEX-DESK:~/.ssh$ cp /mnt/c/users/russalex/.ssh/russ* .
russ@RUSSALEX-DESK:~/.ssh$ eval $(ssh-agent)
Agent pid 306
russ@RUSSALEX-DESK:~/.ssh$ ls
russ_rsa  russ_rsa.pub
russ@RUSSALEX-DESK:~/.ssh$ chmod 600 russ_rsa
russ@RUSSALEX-DESK:~/.ssh$ ssh-add russ_rsa
Identity added: russ_rsa (russ_rsa)
russ@RUSSALEX-DESK:~/.ssh$

Now, if you do not run the chmod command you'll get:

russ@RUSSALEX-DESK:~/.ssh$ ssh-add russ_rsa
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for 'russ_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

Is this what you're doing? If not, any chance you could list out the commands you're running?

russalex avatar Apr 11 '16 20:04 russalex

Closing this thread out since there hasn't been activity since 4/11. If you are continuing to have issues please reopen.

benhillis avatar May 28 '16 16:05 benhillis