Change all of Plesk’s FTP passwords to random

[code lang=”bash”]for i in $(mysql -NB psa -uadmin -p`cat /etc/psa/.psa.shadow` -e ‘select login from sys_users;’); do export PSA_PASSWD=”$(openssl rand 6 -base64)”; /usr/local/psa/admin/bin/usermng –set-user-passwd –user=$i; echo “$i: $PSA_PASSWD” >> ftp_passwords; done [/code]

Thanks Geoff!

One Comments

  • mike

    June 12, 2009

    You can do this with apg if you install the EPEL rpm:

    for i in $(mysql -NB psa -uadmin -p`cat /etc/psa/.psa.shadow` -e ‘select login from sys_users;’); do export PSA_PASSWD=”$(apg -a1 -n1 -m8 -x8 -MNCL)”; /usr/local/psa/admin/bin/usermng –set-user-passwd –user=$i; echo “$i:$PSA_PASSWD” >> ftp_passwords; done

    Here is an example of changing all mail account passwords:

    for i in $(mysql psa -BNe’select concat(mail.mail_name,”@”,domains.name) as address from mail,domains,accounts where mail.dom_id=domains.id and mail.account_id=accounts.id order by address;’); do export PSA_PASSWORD=”$(openssl rand 6 -base64)”; /usr/local/psa/bin/mail.sh -u $i -passwd ”; echo “$i:$PSA_PASSWORD” >> mail_password; done

Leave a Reply