From de251bb77d6ba26596ebad0e2a147f5816a76495 Mon Sep 17 00:00:00 2001 From: Selby Mashiki Date: Sat, 25 Jul 2026 00:15:05 +0200 Subject: [PATCH] fix: add ufw SSH allow rule when sshd is enabled When UFW firewall is selected alongside sshd during installation, UFW would block SSH connections on first boot, locking users out of their system. Check if sshd.service is enabled in the target system by checking the systemd symlink, and if so, run 'ufw allow SSH' inside the chroot to ensure SSH access is not blocked. Fixes #4616 --- archinstall/applications/firewall.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/archinstall/applications/firewall.py b/archinstall/applications/firewall.py index dadaa05b16..5acd37e90f 100644 --- a/archinstall/applications/firewall.py +++ b/archinstall/applications/firewall.py @@ -46,6 +46,11 @@ def install( # write default conf file to enabled ufw_conf = install_session.target / 'etc/ufw/ufw.conf' ufw_conf.write_text(ufw_conf.read_text().replace('ENABLED=no', 'ENABLED=yes')) + # if sshd is enabled, allow SSH through ufw to prevent lockout + sshd_symlink = install_session.target / 'etc/systemd/system/multi-user.target.wants/sshd.service' + if sshd_symlink.exists(): + debug('sshd detected, adding ufw allow rule for SSH') + install_session.arch_chroot('ufw allow SSH') case Firewall.FWD: install_session.add_additional_packages(self.fwd_packages)