Files
linux-scripts/debian/debian-configure-sshd.sh
2023-12-19 20:55:12 -06:00

28 lines
739 B
Bash

#!/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