Assuming you've setup ~/containers/ssh to start a sshd on boot:

sudo systemd-nspawn -D ~/containers/ssh -n -b -p 23:22

The magic is the --port aka -p switch that allows port forwarding from the host to the container.

So when I ssh -p 23 $host I get to my ssh container, since it's redirected to port 22. Sadly ssh does not send the hostname as part of the SSH protocol as discussed in


Powered by Vanilla PHP feedback form