SSH won't work out of the box for a LXC container on Proxmox

If you're used to use LXC container on Proxmox, you may have realised that something is messed up out of the box. It looks like the SSH service does not read the config file, especially the "sshd_config" one. Let's see how to fix that !

SSH won't work out of the box for a LXC container on Proxmox
Photo by Gabriel Heinzer / Unsplash

If you're used to use LXC container on Proxmox, you may have realised that something is messed up out of the box. Thankfully, the fix is quick and easy !

Out of the box, it looks like the SSH service does not read the config file, especially the "sshd_config" one. It appears that this functionnality is broken down by the ssh.socket configuration.

To resolve this issue, we have to basically hide the ssh socket service and disabling / reenabling the proper ssh service.

The fix hold in these four commands :

systemctl mask ssh.socket
systemctl mask sshd.socket

systemctl disable sshd
systemctl enable ssh

Now, restart your container and the problem is fixed !