25 January, 2021

Visual Studio Code Remote Development

With Visual Studio Code you can edit and run code remotely. Install the Remote Development extension. Here for example, I connect to an Ubuntu Linux Server from a Windows 10 machine.

These machines exchange public ssh keys to identify you without using passwords. Check if local ssh keys exists in your home folder C:\Users\phyrum\.ssh\id_rsa.pub. To create a new key open PowerShell and execute:

ssh-keygen -t rsa -b 4096

An optional passphrase can be set to the file. It can be left empty and I have left it empty.

Two files id_rsa and id_rsa.pub are generated in C:\Users\phyrum\.ssh\ one private and one public key.

Register the clients public key, open a PowerShell and execute:


$pubKey=(Get-Content "$PUBKEYPATH" | Out-String); ssh "$USER_AT_HOST" "mkdir -p ~/.ssh && chmod 700 ~/.ssh && echo '${pubKey}' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"

Now we can add the the new host tea.ch from our local development machine. See the tutorial Remote development over SSH