This commit is contained in:
2023-12-22 18:00:31 -06:00
parent d779695f99
commit 9747eba72b

View File

@@ -14,7 +14,7 @@ if [ $isInFile -eq 0 ]
isInFile=$(cat /etc/ssh/sshd_config | grep -c "#PermitRootLogin prohibit-password")
if [ $isInFile -eq 0 ]
then
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak1
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak1 > /dev/null 2>&1
sed -i 's/PermitRootLogin no/#PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config
sed -i 's/PermitRootLogin yes/#PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config
sed -i 's/PermitRootLogin prohibit-password/#PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config
@@ -27,7 +27,7 @@ if [ $isInFile -eq 0 ]
isInFile=$(cat /etc/ssh/sshd_config | grep -c "PasswordAuthentication no")
if [ $isInFile -eq 0 ]
then
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak2
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak2 > /dev/null 2>&1
sed -i 's/#PasswordAuthentication no/PasswordAuthentication no/g' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
@@ -75,7 +75,7 @@ fi
isInFile=$(cat /home/akanealw/.ssh/config | grep -c "*root")
if [ $isInFile -eq 0 ]
then
cp /home/akanealw/.ssh/config /home/akanealw/.ssh/config.bak
cp /home/akanealw/.ssh/config /home/akanealw/.ssh/config.bak > /dev/null 2>&1
mv /home/akanealw/.ssh/known_hosts /home/akanealw/.ssh/known_hosts.old
echo "" >> /home/akanealw/.ssh/config
echo "" >> /home/akanealw/.ssh/config
@@ -97,7 +97,7 @@ fi
isInFile=$(cat /root/.ssh/config | grep -c "*root")
if [ $isInFile -eq 0 ]
then
cp /root/.ssh/config /root/.ssh/config.bak
cp /root/.ssh/config /root/.ssh/config.bak > /dev/null 2>&1
mv /root/.ssh/known_hosts /root/.ssh/known_hosts.old
echo "" >> /root/.ssh/config
echo "" >> /root/.ssh/config