From 4e3053749991a09fbdf17ad93ee6654f4fbbf7a7 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 25 Feb 2024 01:28:18 +0100 Subject: installer/* improve regexp to set ssh port and fix ssh port config for newer ubuntu releases --- roles/raspios/image/templates/firstrun.sh.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles/raspios/image/templates') diff --git a/roles/raspios/image/templates/firstrun.sh.j2 b/roles/raspios/image/templates/firstrun.sh.j2 index 2ff0fd59..d5e72fcc 100644 --- a/roles/raspios/image/templates/firstrun.sh.j2 +++ b/roles/raspios/image/templates/firstrun.sh.j2 @@ -23,7 +23,7 @@ systemctl restart dhcpcd.service {% endif %} {% if ansible_port != 22 %} -sed -e 's/^#*Port .*$/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config +sed -e 's/^\s*#*\s*Port\s\s*[0-9][0-9]*$/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config {% endif %} install -m 0700 -d /root/.ssh install -m 0644 /boot/firstrun.authorized_keys /root/.ssh/authorized_keys -- cgit v1.2.3