Advertisement
w0lgix

cpanelchange.sh

Jun 26th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.69 KB | None | 0 0
  1. #!/bin/bash
  2. #Changes every cPanel password on the server and stores the credentials in ~/newCredentials
  3. #$newPassword is a randomly generated password with 10 characters
  4. export ALLOW_PASSWORD_CHANGE=1
  5. ls -la /home | awk '{print $3}' | grep -v root | grep -v wheel | grep -v cpanel | grep -v apache | grep -v csf | grep -v '^$' > /tmp/usersforchpass
  6. for i in `more /tmp/usersforchpass `
  7. do
  8.         newPassword=$(</dev/urandom tr -dc 'A-Za-z0-9' | head -c10)
  9.         echo "Username: $i|Password: $newPassword" >> ~/cpanel
  10.         echo "" >> ~/newCredentials
  11.         /scripts/chpass $i $newPassword
  12.         /scripts/mysqlpasswd $i $newPassword
  13. done
  14. /scripts/ftpupdate
  15. rm -f /tmp/usersforchpass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement