• Debian 11 is approaching its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.80 will be the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

Question Password Changing Script

KrazyBob

Regular Pleskian
Years ago I got the attached script from Plesk support but never tried it. I see that it needs to be slightly modified but basically it sets a date on which the passwords will be changed and notifies the clients. I have some Plesk 9-12 servers to upgrade to Onyx but want to change the passwords first. Has anyone tried this script? Modified it?


Plesk - Ensim Encryped Password Email Scripts

# to prepare a list of mail names with new passwords:

mysql -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -e"select concat(m.mail_name, '@', d.name) from domains d, mail m, accounts a where m.dom_id=d.id and m.account_id=a.id and a.type='crypt'" | while read mailname ; do newpass=`tr -dc A-Za-z0-9_%#- < /dev/urandom | head -c 12` ; echo $mailname $newpass ; done > list.txt

# to notify users (please, change the text in quotes):

cat list.txt | while read mailname password ; do echo "Starting 2011-05-10 your mailname account's password will be changed to $password" | mail -s "Password change notification" $mailname ; done

# to change passwords on day X:

cat list.txt | while read mailname password ; do /usr/local/psa/bin/mail -u $mailname -passwd_type plain -passwd "$password" ; done

=====

After further testing on our test environment I have made some corrections to the scripts for web users. Please, use this last version:

# To prepare lists of users with new passwords:

ftpusers: mysql -Ns -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -e"select s.login, d.name from domains d, hosting h, sys_users s, accounts a where a.type='crypt' and a.id=s.account_id and s.id=h.sys_user_id and h.dom_id=d.id" | while read login; do newpass=`tr -dc A-Za-z0-9_%#- < /dev/urandom | head -c 12` ; echo $login $newpass ; done > ftpusers.txt

ftpsubusers: mysql -Ns -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -e"select concat(sd.name, '.', d.name), s.login from domains d, subdomains sd, sys_users s, accounts a where a.type='crypt' and sd.dom_id=d.id and sd.sys_user_type='native' and sd.sys_user_id=s.id and s.account_id=a.id;" | while read login; do newpass=`tr -dc A-Za-z0-9_%#- < /dev/urandom | head -c 12` ; echo $login $newpass ; done > subftpusers.txt

webusers: mysql -Ns -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -e"select s.login, d.name from domains d, web_users wu, sys_users s, accounts a where a.type='crypt' and a.id=s.account_id and s.id=wu.sys_user_id and wu.dom_id=d.id" | while read login; do newpass=`tr -dc A-Za-z0-9_%#- < /dev/urandom | head -c 12` ; echo $login $newpass ; done > webusers.txt


# To change passwords:

cat ftpusers.txt | while read login name password; do /usr/local/psa/bin/domain -u $name -login $login -passwd_type plain -passwd "$password" ; done

cat subftpusers.txt | while read login name password ; do /usr/local/psa/bin/subdomain -u $name -login $login -passwd_type plain -passwd "$password" ; done

cat webusers.txt | while read login name password ; do /usr/local/psa/bin/webuser -u $login -passwd_type plain -passwd "$password" -domain $name ; done
 
Back
Top