From 70df399e036092f9b84cd6b82f00523c3f4adeff Mon Sep 17 00:00:00 2001 From: akanealw Date: Tue, 19 Dec 2023 20:55:12 -0600 Subject: [PATCH] testing configure ssh script --- debian/debian-configure-sshd.sh | 27 +++++++++++++++++++++++++++ debian/debian-essentials.sh | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 debian/debian-configure-sshd.sh diff --git a/debian/debian-configure-sshd.sh b/debian/debian-configure-sshd.sh new file mode 100644 index 0000000..cebac40 --- /dev/null +++ b/debian/debian-configure-sshd.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +if [ "$EUID" -ne 0 ] + then + echo "Please run as root" + exit +fi + +isInFile=$(cat /etc/hostname | grep -c "proxmox") +if [ $isInFile -eq 0 ] + then + isInFile=$(cat /etc/ssh/sshd_config | grep -c "#PermitRootLogin prohibit-password") + if [ $isInFile -eq 0 ] + then + sed s/PermitRootLogin yes/#PermitRootLogin prohibit-password/g > /etc/ssh/sshd_config + fi +fi + +isInFile=$(cat /etc/hostname | grep -c "proxmox") +if [ $isInFile -eq 0 ] + then + isInFile=$(cat /etc/ssh/sshd_config | grep -c "PasswordAuthentication no") + if [ $isInFile -eq 0 ] + then + sed s/#PasswordAuthentication yes/PasswordAuthentication no/g > /etc/ssh/sshd_config + fi +fi diff --git a/debian/debian-essentials.sh b/debian/debian-essentials.sh index d909ffa..a589697 100755 --- a/debian/debian-essentials.sh +++ b/debian/debian-essentials.sh @@ -6,7 +6,7 @@ if [ "$EUID" -ne 0 ] exit fi -# autoreply config update dialog with no +# autoreply config update dialog with default answer no if [[ ! -f /etc/apt/apt.conf.d/local ]] then echo "Dpkg::Options {" >> /etc/apt/apt.conf.d/local