1
0
forked from finn/tinyboard

fix SSH service detection across distros; fix misleading key copied message

This commit is contained in:
Justin Oros
2026-04-18 13:43:33 -07:00
parent 9e6a6f2222
commit 72a58cc390
3 changed files with 22 additions and 17 deletions

View File

@@ -161,14 +161,18 @@ for DIRECTIVE in "GatewayPorts yes" "AllowTcpForwarding yes" "ClientAliveInterva
info "$DIRECTIVE set."
done
if systemctl enable ssh 2>/dev/null; then
systemctl restart ssh
elif systemctl enable sshd 2>/dev/null; then
systemctl restart sshd
SSH_SVC=""
if systemctl list-unit-files ssh.service >/dev/null 2>&1 && systemctl enable ssh 2>/dev/null; then
SSH_SVC="ssh"
elif systemctl list-unit-files sshd.service >/dev/null 2>&1 && systemctl enable sshd 2>/dev/null; then
SSH_SVC="sshd"
fi
if [ -n "$SSH_SVC" ]; then
systemctl restart "$SSH_SVC"
info "SSH server restarted."
else
warn "Could not enable/restart SSH service — please start it manually."
fi
info "SSH server restarted."
header "Password Authentication"
read -rp "Disable password auth for $HUB_USER and use keys only? [Y/n]: " DISABLE_PASS
@@ -193,9 +197,7 @@ if [[ "${DISABLE_PASS,,}" == "y" ]]; then
warn "If you are connected via SSH, your session may drop."
warn "Make sure you can reconnect using your key before continuing."
read -rp "Press ENTER to restart SSH or CTRL+C to abort..."
if systemctl restart ssh 2>/dev/null; then
info "SSH restarted."
elif systemctl restart sshd 2>/dev/null; then
if [ -n "$SSH_SVC" ] && systemctl restart "$SSH_SVC" 2>/dev/null; then
info "SSH restarted."
else
warn "Could not restart SSH — please restart it manually."