Skip to content

Instantly share code, notes, and snippets.

@gyng
Created May 4, 2022 09:16
Show Gist options
  • Save gyng/cf7fce4c8200363246f3a1fb07d57e06 to your computer and use it in GitHub Desktop.
Save gyng/cf7fce4c8200363246f3a1fb07d57e06 to your computer and use it in GitHub Desktop.
Setting up VSCode remote SSH server for Ubuntu

Server configuration

Install ssh if needed: eg, Ubuntu: https://ubuntu.com/server/docs/service-openssh

On the server: sudo vi /etc/ssh/sshd_config

AllowTcpForwarding yes
PasswordAuthentication no

Change the port if you want to, but leaving it at 22 seemed to fix some issues

Port 2222

Add the contents of the host's public key eg. cat ~/.ssh/id_ed25519.pub or whatever .pub file is in ~/.ssh

to a new line in ~/.ssh/authorized_hosts on the host.

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAp9idF3NBh7SP0giBmglthuLKKLJolffeD5548st3Kv xxx@xxx.com

Host configuration

On Windows, easiest to use wsl's SSH to get around key permissions issues: https://zitseng.com/archives/20325

Configure the extension. For example, pointing IdentityFile to a path inside WSL

Host 192.168.1.168
  HostName 192.168.1.168
  IdentityFile ~/.ssh/id_ed25519
  Port 2222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment