lxc template ubuntu 22.04 can't change ssh port

Yogorov

Renowned Member
Sep 1, 2015
23
3
68
Hi everyone:

I use this template create a CT
http://download.proxmox.com/images/system/ubuntu-22.04-standard_22.04-1_amd64.tar.zst

when I wanna change ssh 22port to another port won't work.

here is detail:

vim /etc/ssh/sshd_config modify Port 22 to 2933 /etc/init.d/ssh restart

it work! ssh port change to 2933 but after reboot this Container it back to 22 port

here is another cmd to try , it still won't work

vim /etc/default/ssh modify this SSHD_OPTS="-p 2933" systemctl restart sshd.service
it only work this time but still won't work after reboot

anyone can help this?
 
Quick workaround: do one of the above and create file /etc/rc.local with execute rights:
Code:
#!/bin/bash
/etc/init.d/ssh restart