moved around options
This commit is contained in:
17
debian/debian-configure-sshd.sh
vendored
17
debian/debian-configure-sshd.sh
vendored
@@ -1,20 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ "$EUID" -ne 0 ]
|
if [ "$EUID" -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "Please run as root"
|
echo "Please run as root"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# sshd config
|
# sshd config
|
||||||
|
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak > /dev/null 2>&1
|
||||||
isInFile=$(cat /etc/hostname | grep -c "proxmox")
|
isInFile=$(cat /etc/hostname | grep -c "proxmox")
|
||||||
if [ $isInFile -eq 0 ]
|
if [ $isInFile -eq 0 ]
|
||||||
then
|
then
|
||||||
isInFile=$(cat /etc/ssh/sshd_config | grep -c "#PermitRootLogin prohibit-password")
|
isInFile=$(cat /etc/ssh/sshd_config | grep -c "#PermitRootLogin prohibit-password")
|
||||||
if [ $isInFile -eq 0 ]
|
if [ $isInFile -eq 0 ]
|
||||||
then
|
then
|
||||||
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 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 yes/#PermitRootLogin prohibit-password/g' /etc/ssh/sshd_config
|
||||||
sed -i 's/PermitRootLogin prohibit-password/#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,6 @@ if [ $isInFile -eq 0 ]
|
|||||||
isInFile=$(cat /etc/ssh/sshd_config | grep -c "PasswordAuthentication no")
|
isInFile=$(cat /etc/ssh/sshd_config | grep -c "PasswordAuthentication no")
|
||||||
if [ $isInFile -eq 0 ]
|
if [ $isInFile -eq 0 ]
|
||||||
then
|
then
|
||||||
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 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
|
||||||
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
|
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
|
||||||
@@ -36,7 +35,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# authorized_keys akanealw
|
# authorized_keys akanealw
|
||||||
cp /home/akanealw/.ssh/authorized_keys /home/akanealw/.ssh/authorized_keys.bak
|
cp /home/akanealw/.ssh/authorized_keys /home/akanealw/.ssh/authorized_keys.bak > /dev/null 2>&1
|
||||||
isInFile=$(cat /home/akanealw/.ssh/authorized_keys | grep -c "winpc-akanealw")
|
isInFile=$(cat /home/akanealw/.ssh/authorized_keys | grep -c "winpc-akanealw")
|
||||||
if [ $isInFile -eq 0 ]
|
if [ $isInFile -eq 0 ]
|
||||||
then
|
then
|
||||||
@@ -79,8 +78,7 @@ if [ $isInFile -eq 0 ]
|
|||||||
mv /home/akanealw/.ssh/known_hosts /home/akanealw/.ssh/known_hosts.old
|
mv /home/akanealw/.ssh/known_hosts /home/akanealw/.ssh/known_hosts.old
|
||||||
echo "" >> /home/akanealw/.ssh/config
|
echo "" >> /home/akanealw/.ssh/config
|
||||||
echo "" >> /home/akanealw/.ssh/config
|
echo "" >> /home/akanealw/.ssh/config
|
||||||
echo "Host *root" >> /home/akanealw/.ssh/config
|
echo "Host *-root" >> /home/akanealw/.ssh/config
|
||||||
echo "Port 22" >> /home/akanealw/.ssh/config
|
|
||||||
echo "User root" >> /home/akanealw/.ssh/config
|
echo "User root" >> /home/akanealw/.ssh/config
|
||||||
echo "IdentityFile /root/.ssh/server-root" >> /home/akanealw/.ssh/config
|
echo "IdentityFile /root/.ssh/server-root" >> /home/akanealw/.ssh/config
|
||||||
echo "" >> /home/akanealw/.ssh/config
|
echo "" >> /home/akanealw/.ssh/config
|
||||||
@@ -101,8 +99,7 @@ if [ $isInFile -eq 0 ]
|
|||||||
mv /root/.ssh/known_hosts /root/.ssh/known_hosts.old
|
mv /root/.ssh/known_hosts /root/.ssh/known_hosts.old
|
||||||
echo "" >> /root/.ssh/config
|
echo "" >> /root/.ssh/config
|
||||||
echo "" >> /root/.ssh/config
|
echo "" >> /root/.ssh/config
|
||||||
echo "Host *root" >> /root/.ssh/config
|
echo "Host *-root" >> /root/.ssh/config
|
||||||
echo "Port 22" >> /root/.ssh/config
|
|
||||||
echo "User root" >> /root/.ssh/config
|
echo "User root" >> /root/.ssh/config
|
||||||
echo "IdentityFile /root/.ssh/server-root" >> /root/.ssh/config
|
echo "IdentityFile /root/.ssh/server-root" >> /root/.ssh/config
|
||||||
echo "" >> /root/.ssh/config
|
echo "" >> /root/.ssh/config
|
||||||
|
|||||||
Reference in New Issue
Block a user