- Open Windows command prompt.
- Generate a separate SSH key in file id_rsa-remote-ssh.
ssh-keygen -t rsa -b 4096 -f %USERPROFILE%\.ssh\id_rsa-remote-ssh - Add the contents of the local id_rsa-remote-ssh.pub file generated in step 2 to the appropriate authorized_keys file(s) on the SSH host.
SET REMOTEHOST=name-of-ssh-hostSET PATHOFIDENTITYFILE=%USERPROFILE%\.ssh\id_rsa-remote-ssh.pubscp %PATHOFIDENTITYFILE% %REMOTEHOST%:~/tmp.pubssh %REMOTEHOST% "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat ~/tmp.pub >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys && rm -f ~/tmp.pub" - In VS Code, run Remote-SSH: Open Configuration File... in the Command Palette (F1), select an SSH config file, and add (or modify) a host entry as follows:
Host name-of-ssh-host
User your-user-name-on-host
HostName host-fqdn-or-ip-goes-here
IdentityFile ~/.ssh/id_rsa-remote-ssh
Example of config file:
Host my_machine
User kbinias
HostName 192.168.12.34
IdentityFile ~/.ssh/id_rsa-remote-ssh