From 8c1a3ff8024377e2efed51c461c1190c25da9d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mina=20Gali=C4=87?= Date: Tue, 16 May 2023 22:37:42 +0100 Subject: FreeBSD: Fix user account locking (#4114) On Linux, we only disable login via Password authentication. On FreeBSD, we were right out locking the account. This was reported back when #93 was merged, but back then I didn't understand that. Newly created FreeBSD users can now login with with SSH keys. Sponsored by: The FreeBSD Foundation LP: #1854594 Fixes: #3507 --- cloudinit/distros/freebsd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cloudinit/distros/freebsd.py b/cloudinit/distros/freebsd.py index 443d0961..32cff9b9 100644 --- a/cloudinit/distros/freebsd.py +++ b/cloudinit/distros/freebsd.py @@ -148,9 +148,9 @@ class Distro(cloudinit.distros.bsd.BSD): def lock_passwd(self, name): try: - subp.subp(["pw", "usermod", name, "-h", "-"]) + subp.subp(["pw", "usermod", name, "-w", "no"]) except Exception: - util.logexc(LOG, "Failed to lock user %s", name) + util.logexc(LOG, "Failed to lock password login for user %s", name) raise def apply_locale(self, locale, out_fn=None): -- cgit v1.2.1