don't fail distro agnostic sshd adjustments when config is not found (#8729)

* don't fail ssh distro agnostic when openssh is not used

* addressing rabbit nit-pick

reasonable

* fix wording

Co-authored-by: tabrisnet <96966042+tabrisnet@users.noreply.github.com>

---------

Co-authored-by: tabrisnet <96966042+tabrisnet@users.noreply.github.com>
This commit is contained in:
Werner 2025-10-09 14:45:44 +02:00 committed by GitHub
parent a6f0159fd4
commit 851683566d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -487,11 +487,13 @@ function install_distribution_agnostic() {
echo "nameserver $NAMESERVER" > "${SDCARD}"/etc/resolvconf/resolv.conf.d/head
fi
# permit root login via SSH for the first boot
sed -i 's/#\?PermitRootLogin .*/PermitRootLogin yes/' "${SDCARD}"/etc/ssh/sshd_config
# enable PubkeyAuthentication
sed -i 's/#\?PubkeyAuthentication .*/PubkeyAuthentication yes/' "${SDCARD}"/etc/ssh/sshd_config
# don't fail if OpenSSH is missing, e.g. if dropbear is installed instead
if [[ -f "${SDCARD}"/etc/ssh/sshd_config ]]; then
# permit root login via SSH for the first boot
sed -i 's/#\?PermitRootLogin .*/PermitRootLogin yes/' "${SDCARD}"/etc/ssh/sshd_config
# enable PubkeyAuthentication
sed -i 's/#\?PubkeyAuthentication .*/PubkeyAuthentication yes/' "${SDCARD}"/etc/ssh/sshd_config
fi
# avahi daemon defaults if exists
[[ -f "${SDCARD}"/usr/share/doc/avahi-daemon/examples/sftp-ssh.service ]] &&