#!/bin/bash clear [[ $(grep -c "#PermitRootLogin" /etc/ssh/sshd_config) != '0' ]] && { sed -i "s/#PermitRootLogin/PermitRootLogin/g" /etc/ssh/sshd_config } > /dev/null [[ $(grep -c "PasswordAuthentication" /etc/ssh/sshd_config) = '0' ]] && { echo 'PasswordAuthentication yes' > /etc/ssh/sshd_config } > /dev/null [[ $(grep -c "PasswordAuthentication no" /etc/ssh/sshd_config) != '0' ]] && { sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config } > /dev/null [[ $(grep -c "#PasswordAuthentication no" /etc/ssh/sshd_config) != '0' ]] && { sed -i "s/#PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config } > /dev/null service ssh restart > /dev/null echo -e "\033[1;31mAtencao!!\033[0m" echo " " echo -e "\033[1;37mEssa senha sera usada para entrar no seu servidor \033[0m" echo -ne "\033[1;32mDefina a senha root\033[1;37m: "; read senha [[ -z "$senha" ]] && { echo -e "\n\033[1;31mSenha invalida !\033[0m" exit 0 } echo "root:$senha" | chpasswd echo -e "\n\033[1;31m[ \033[1;37mok ! \033[1;31m]\033[1;37m - \033[1;32mSenha definida ! \033[0m"