SSH and VSCodium
I want to access my servers via SSH in VSCodium. Let’s setup a plain Debian 11 host and Home Assistant 10.
VSCodium
-
Install VSCodium extension: jeanp413.open-remote-ssh
-
Configure the extension per the instructions.
-
In file
~/.vscode-oss/argv.json
add the following code to the bottom of the file and save
{ "enable-proposed-api": [ "jeanp413.open-remote-ssh", ] }
- reload VSCodium
-
Remote Hosts
The basic gist is:
- Add SSH public key
- SSH config: Allow TCP forwarding
- Install dependencies (e.g. curl)
Home Assistant
-
Install Home Assistant Community Add-on: Advanced SSH & Web Terminal Note the Official add-on Terminal & SSH does not support the port forwarding.
-
Configure Advanced SSH & Web Terminal N.B. This is setup with root as the SSH user. I tried creating another user but the new user couldn’t do what I needed right away, even when adding them to the root group.
ssh: username: root password: "" authorized_keys: - >- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIpnKCXYVleM0ikozrgmQKQ18nZUEGX+OT/X4fEJxotq josh@doiotyourself.com sftp: false compatibility_mode: false allow_agent_forwarding: false allow_remote_port_forwarding: true allow_tcp_forwarding: true zsh: true share_sessions: false packages: - gcompat - libstdc++ - curl init_commands: []
-
If Home Assistant is not a host in
~/.ssh/config
then add it:Host 192.168.107.17 User root
-
Connect to Home Assistant FTW
Debian Server
-
Copy your public key to the Debian Server
josh@debian:~$ mkdir -p ~/.ssh josh@debian:~$ echo ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIpnKCXYVleM0ikozrgmQKQ18nZUEGX+OT/X4fEJxotq josh@doiotyourself.com >> ~/.ssh/authorized_keys josh@debian:~$ chmod -R go= ~/.ssh
-
Test that you can authenticate to Debian Server Using SSH Keys
-
More SSH configuration
josh@debian:~$ su - Password: root@debian:~# nano /etc/ssh/sshd_config
AllowTcpForwarding yes # And while we're here, let's improve security PermitRootLogin no PasswordAuthentication no
root@debian:~# systemctl restart ssh
-
Install sudo
# su - Password: # apt install sudo # usermod -aG sudo josh # getent group sudo sudo:x:27:josh # logout ~ logout
-
Install curl on Debian Server
root@debian:~# apt install curl
-
Connect to Debian Server FTW