SSH into a Toolbox

Running code from toolbox would be a valid option… Only for some reason the Adwaita (dark) theme is not applied to the menu-bar and menu which is a huge no-go for me.

There is a way to ssh into your container though, something like this:

⬢[root@toolbox ~]# dnf install -y openssh-server
Fedora Modular 31 - x86_64                                                                                                     
...
Complete!
⬢[root@toolbox ~]# /usr/libexec/openssh/sshd-keygen dsa
⬢[root@toolbox ~]# /usr/libexec/openssh/sshd-keygen rsa
⬢[root@toolbox ~]# /usr/libexec/openssh/sshd-keygen ecdsa
⬢[root@toolbox ~]# /usr/libexec/openssh/sshd-keygen ed25519

Open /etc/ssh/sshd_config to change the line with:

#
# Port 22
#AddressFamily any

in

#
Port 2222
#AddressFamily any

And you can now fire the sshd with:

 ⬢[root@toolbox ~]# /usr/sbin/sshd 

Due to container limitations this sshd won’t be able to allocate a /dev/pty, so interactive shells won’t work:

$ ssh -p 2222 localhost
Connection to localhost closed by remote host.
Connection to localhost closed.

But non-interactive ssh sessions work just fine:

 $ ssh -p 2223 localhost date
 Wed Jan  1 13:57:54 CET 2020

And apparently that’s enough for a remote ssh connection from VS Code.

Adding the following to ~/.ssh/config and you’re ready to roll:

Host ToolboxDev
  Port 2222
  HostName localhost
1 Like