I have a host Windows operating system and I have my ssh keys setup on my windows machine to access github and other resources. Now I installed a guest Linux OS using VMware player. Can I re-use the private keys on the windows machine on the Linux machine? How do I let the Linux know where the private keys are located.
1 Answer
Assume you have VMware Tools installed in your VM: select your key file in Windows Explorer, copy it to clipboard, switch to VM and paste it.
Move it to ~/.ssh/ (if directory not present, create it with mkdir; it's hidden by default, so make sure to enable Show Hidden Files in Gnome File Explorer, or use ls -alF in terminal), rename it to id_rsa.
Enforce key file's permission: chmod 600 ~/.ssh/id_rsa (IMPORTANT, otherwise Linux would refuse to use this key file)
Okay you're all set. All commands will use your key file by default.
-
The
~..ssh
directory should also be unreadable by others (chmod 700 ~/.ssh
– xenoidSep 21, 2017 at 7:55 -
@xenoid I tried on Ubuntu 16.04 and macOS, setting ~/.ssh 0755 and ssh does not seem to complain. If ~/.ssh is created automatically by sshd, it will be 0700, indeed. Sep 21, 2017 at 8:01