Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #We need to create servlist.sh file and enter all Ip or hostname in it. if using hostname make sure its resolving in DNS.
- for i in `cat servlist.sh`
- do
- HOST=$i
- USER="root"
- PASS="..."
- VAR=$(expect -c "
- spawn ssh -o StrictHostKeyChecking=no $USER@$HOST
- expect "*?assword:*"
- send -- "$PASSr"
- send -- "r"
- expect eof
- ")
- echo "================================="
- # Editing Password policies in Login.defs
- sed -i -r -e "/PASS_MIN_LEN/s/[0-9]+$/5/" /etc/login.defs
- #
- sed -i -r -e "/PASS_MAX_DAYS/s/[0-9]+$/90/" /etc/login.defs
- #
- sed -i -r -e "/PASS_MIN_DAYS/s/[0-9]+$/1/" /etc/login.defs
- sed -i -r -e "/PASS_WARN_AGE/s/[0-9]+$/5/" /etc/login.defs
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement