/srv/irclogs.ubuntu.com/2021/08/27/#cloud-init.txt

jbghow can I prevent cloud-init from starting openssh? the service is not enabled via systemd but gets started anyway when cloud-init runs09:12
falcojrjbg: ssh.service is disabled? ssh is included and enabled in cloud images, but running cloud-init shouldn't affect it13:51
jbgfalcojr: yes, sshd.service is disabled. the distro is arch. it seems that cloud-init effectively runs `systemctl restart sshd`, which starts sshd if it was not already running14:01
jbgafter cloud-init completes, the service is still not enabled (would not start automatically), but it is started14:01
jbgi worked around it by stopping sshd after cloud-init completes, but it's annoying14:02
falcojrhave you tried masking the ssh service?14:10
jbgi could do that, but i do want sshd to run on some systems that use this image (on those systems i run systemctl enable --now sshd during startup)14:43
jbgi'd rather find out why something is starting it14:44
jbgit appears to be cloud-init so i guess it's some module14:44
falcojrnothing in the codebase starts it. It's likely just the dependency chain. I'll admit I don't know systemd as well as I should, but IIRC a disabled service will still get started if another service depends on it16:11
=== smoser1 is now known as smoser
andyfthe set user passwords module restarts ssh if it tweaks the config.16:48
rharperfalcojr: if pw_auth is set, then cc_setup_passwords.py will update sshd config and do a service restart on ssh  16:52
rharperjbg: if cloud-init restarts ssh, you can see the command it runs in /var/log/cloud-init.log ;   16:59
jbgrharper: thanks, i'll check that out18:12
jbgand yes, it does look like setup passwords is doing it18:13
jbgand restarting ssh starts it if it's not already running, even if it's not enabled18:14
jbgi wonder if it could be changed to do systemctl try-restart18:14
rharperalternatively jbg you can not include ssh_pwauth in your user-config, or use ssh_pwauth: unchanged 18:57
rharperjbg: I think using try-restart would also be an acceptable upstream change 19:00

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!