[SOLVED] SSH doesn't work as expected in LXC

qwertbert

New Member
Dec 31, 2021
5
2
3
38
that's normal though? when you change the config file you'd need to restart/reload the service.
Well, that's right.
But when I reboot the container, shouldn't the SSH settings I configured in the configuration be used?
This is not the case until I restart the SSH server after the container restart.

How to reproduce:
  1. Start latest LXC container with Debian 11
  2. Connect to container with SSH
  3. Configure 1337 as SSH port in /etc/ssh/sshd_config
  4. Restart SSH server.
  5. Connect to container via port 1337. <- works!
  6. Restart the container.
  7. SSH uses port 22 again.
 
Last edited:
  • Like
Reactions: ledufakademy

oguz

Proxmox Retired Staff
Retired Staff
Nov 19, 2018
5,207
695
118
But when I reboot the container, shouldn't the SSH settings I configured in the configuration be used?
This is not the case until I restart the SSH server after the container restart.
what settings did you change? is the ssh service enabled?

and how are you rebooting the container?
 

qwertbert

New Member
Dec 31, 2021
5
2
3
38
what settings did you change? is the ssh service enabled?

and how are you rebooting the container?
Sorry, I edited my last post with additional info.
Usually I restart the container via Proxmox with "Reboot".
SSH is enabled, yes.
Code:
root@foundry:~# systemctl status sshd
* ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
     Active: inactive (dead)
       Docs: man:sshd(8)
             man:sshd_config(5)
 

oguz

Proxmox Retired Staff
Retired Staff
Nov 19, 2018
5,207
695
118
Usually I restart the container via Proxmox with "Reboot".
SSH is enabled, yes.
after you're done editing the config in /etc/ssh/sshd_config:
Code:
systemctl disable ssh.socket
systemctl enable ssh
reboot

works here :)
 
  • Like
Reactions: qwertbert

ledufakademy

Member
Sep 10, 2021
51
1
8
48
Ubuntu 20.04 LTS container are painfull !

Failed to enable unit: Refusing to operate on alias name or linked unit file: sshd.service
 

ledufakademy

Member
Sep 10, 2021
51
1
8
48
* ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:sshd(8)
man:sshd_config(5)
 

rolisr

New Member
Jul 19, 2022
1
1
3
  • Like
Reactions: ledufakademy

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!