Advertisement
Guest User

Untitled

a guest
Apr 14th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #!/bin/bash
  2. #We need to create servlist.sh file and enter all Ip or hostname in it. if using hostname make sure its resolving in DNS.
  3. for i in `cat servlist.sh`
  4. do
  5. HOST=$i
  6. USER="root"
  7. PASS="..."
  8. VAR=$(expect -c "
  9. spawn ssh -o StrictHostKeyChecking=no $USER@$HOST
  10. expect "*?assword:*"
  11. send -- "$PASSr"
  12. send -- "r"
  13. expect eof
  14. ")
  15. echo "================================="
  16. # Editing Password policies in Login.defs
  17. sed -i -r -e "/PASS_MIN_LEN/s/[0-9]+$/5/" /etc/login.defs
  18. #
  19. sed -i -r -e "/PASS_MAX_DAYS/s/[0-9]+$/90/" /etc/login.defs
  20. #
  21. sed -i -r -e "/PASS_MIN_DAYS/s/[0-9]+$/1/" /etc/login.defs
  22. sed -i -r -e "/PASS_WARN_AGE/s/[0-9]+$/5/" /etc/login.defs
  23. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement