1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #!/bin/bash
- clear
- [[ "$(whoami)" != "root" ]] && {
- clear
- echo -e "\033[1;31mExeculte como usuario root, \033[1;32m(\033[1;37msudo -i\033[1;32m)\033[0m"
- exit
- }
- [[ $(grep -c "prohibit-password" /etc/ssh/sshd_config) != '0' ]] && {
- sed -i "s/prohibit-password/yes/g" /etc/ssh/sshd_config
- } > /dev/null
- [[ $(grep -c "without-password" /etc/ssh/sshd_config) != '0' ]] && {
- sed -i "s/without-password/yes/g" /etc/ssh/sshd_config
- } > /dev/null
- [[ $(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
- iptables -F
- iptables -A INPUT -p tcp --dport 81 -j ACCEPT
- iptables -A INPUT -p tcp --dport 80 -j ACCEPT
- iptables -A INPUT -p tcp --dport 443 -j ACCEPT
- iptables -A INPUT -p tcp --dport 8799 -j ACCEPT
- iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
- iptables -A INPUT -p tcp --dport 1194 -j ACCEPT
- 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"
|