2

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
  • 1
    Try copying the key files to the appropriate location on the VM.
    – Scott
    Sep 21 '17 at 0:51
6

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.

2
  • The ~..ssh directory should also be unreadable by others (chmod 700 ~/.ssh
    – xenoid
    Sep 21 '17 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.
    – Chang Qian
    Sep 21 '17 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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