root


SUBMITTED BY: Guest

DATE: June 12, 2024, 1:54 p.m.

FORMAT: Text only

SIZE: 1.1 kB

HITS: 264

  1. #!/bin/bash
  2. clear
  3. [[ $(grep -c "#PermitRootLogin" /etc/ssh/sshd_config) != '0' ]] && {
  4. sed -i "s/#PermitRootLogin/PermitRootLogin/g" /etc/ssh/sshd_config
  5. } > /dev/null
  6. [[ $(grep -c "PasswordAuthentication" /etc/ssh/sshd_config) = '0' ]] && {
  7. echo 'PasswordAuthentication yes' > /etc/ssh/sshd_config
  8. } > /dev/null
  9. [[ $(grep -c "PasswordAuthentication no" /etc/ssh/sshd_config) != '0' ]] && {
  10. sed -i "s/PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config
  11. } > /dev/null
  12. [[ $(grep -c "#PasswordAuthentication no" /etc/ssh/sshd_config) != '0' ]] && {
  13. sed -i "s/#PasswordAuthentication no/PasswordAuthentication yes/g" /etc/ssh/sshd_config
  14. } > /dev/null
  15. service ssh restart > /dev/null
  16. echo -e "\033[1;31mAtencao!!\033[0m"
  17. echo " "
  18. echo -e "\033[1;37mEssa senha sera usada para entrar no seu servidor
  19. \033[0m"
  20. echo -ne "\033[1;32mDefina a senha root\033[1;37m: "; read senha
  21. [[ -z "$senha" ]] && {
  22. echo -e "\n\033[1;31mSenha invalida !\033[0m"
  23. exit 0
  24. }
  25. echo "root:$senha" | chpasswd
  26. echo -e "\n\033[1;31m[ \033[1;37mok ! \033[1;31m]\033[1;37m - \033[1;32mSenha definida ! \033[0m"

comments powered by Disqus