Article ID: 113391, created on Mar 14, 2012, last review on Aug 12, 2014

  • Applies to:
  • Plesk Onyx for Linux
  • Plesk 12.5 for Linux
  • Plesk 12.0 for Linux
  • Plesk 11.0 for Linux
  • Plesk 11.5 for Linux
  • Plesk 10.4 for Linux/Unix
  • Plesk Onyx for Windows
  • Plesk 12.5 for Windows
  • Plesk 12.0 for Windows
  • Plesk 11.0 for Windows
  • Plesk 11.5 for Windows
  • Plesk 10.4 for Windows

发行说明


此大规模密钥重设脚本能够允许 Parallels Plesk Panel(PP)所有者以自动的方式重设所有 PP 账户的密码。

欢迎您到 Plesk 论坛来给我们提供您有关该脚本的反馈。

注意:拥有在 PBA-S 中注册的 PP 节点的用户必须执行 "PBA-S 细则中所描述的操作。"

使用:

1. 下载该脚本 到您的 PP 服务器。
2. 解压。
3. 根据如下说明运行该脚本。

Note: exec 在 php.ini 以下行的 plesk_password_changer.php 执行注释的时间表述中必须启用 PHP 的 exec 函数: php.ini

disable_functions = "apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, eval, exec, ... , mysql_pconnect"


Linux:
# /usr/local/psa/bin/sw-engine-pleskrun plesk_password_changer.php `cat /etc/psa/.psa.shadow` ['new admin password'] [options]

 
Windows:
"%plesk_dir%\additional\PleskPHP5\php.exe" -d open_basedir= -d safe_mode=0 plesk_password_changer.php <old admin password> [new admin password] [options]

 
其中 [options] 可能会是:
         --all - [default] reset passwords for all supported entities
         --admin - reset password for admin
         --additionaladmins - reset passwords for additional administrators accounts
         --clean-up-sessions - clean up sessions table in Plesk database
         --resellers - reset passwords for resellers
         --clients - reset passwords for clients
         --domains - reset passwords for main FTP account of domains
         --domainadmins - reset passwords for Domain Administrators
         --users - change passwords for hosting panel users
         --additionalftpaccounts - reset passwords for additional FTP accounts for domains
         --subdomains - reset passwords for subdomains. NOTE: For Plesk 10.x subdomains treated as domains.
         --webusers - reset passwords for Web Users
         --mailaccounts - reset passwords for mail accounts
         --pdusers - change passwords for protected directories users
 
例如:
php -d open_basedir= -d safe_mode=0 plesk_password_changer.php `cat /etc/psa/.psa.shadow` # 表示将要被重设的所有 PP 的密码,会自动生成 admin 的密码。
php -d open_basedir= -d safe_mode=0 plesk_password_changer.php `cat /etc/psa/.psa.shadow`  --domains # 仅表示域名的主 FTP 账户的密码
php -d open_basedir= -d safe_mode=0 plesk_password_changer.php `cat /etc/psa/.psa.shadow` 's3$ret!' --admin --clients # 表示将要重设的 admin 与客户密码,admin 的密码将为“s3$ret!” (不包含引号)
php -d open_basedir= -d safe_mode=0 plesk_password_changer.php `cat /etc/psa/.psa.shadow` 's3$ret!' # 表示将要被重设的所有 PP 的密码,admin 的密码将为“s3$ret!” (不包含引号)

Important information:
会自动生成 PP "admin" 密码(如果<新 admin 密码>未指定)。
该脚本会写入新的密码与有关已更新账户的信息至 new_plesk_passwords.csv 文件。
输出信息示例:

[2011-10-11 11:30:55][INFO] ==> Installed Plesk version/build: 10.4.4 Debian 5.0 1013111102.18

[2011-10-11 11:30:55][INFO] ==> Detect system configuration
[2011-10-11 11:30:55][INFO] OS: Debian GNU/Linux 5.0 \n \l
[2011-10-11 11:30:55][INFO] Arch: i386

[2011-10-11 11:30:55][INFO] ==> Validate given db password
[2011-10-11 11:30:55][INFO] Result: OK

[2011-10-11 11:30:55][INFO] ==> Plesk Password Changer version: 10.4.0.23

[2011-10-11 11:30:55][INFO] ==> STEP 1: Change password for resellers...
[2011-10-11 11:30:56][INFO] Reseller login: res1 Email: reseller1@mail.com New password: Ajx3J4cHDjaG
[2011-10-11 11:30:57][INFO] Reseller login: res2 Email:
reseller2@mail.com New password: Ua7TPxc6lsk9

[2011-10-11 11:30:57][INFO] ==> STEP 2: Change password for clients...
[2011-10-11 11:30:58][INFO] Client login: cl1 Email: client1@mail.com New password: qiCJJd1525Im
[2011-10-11 11:30:59][INFO] Client login: cl2 Email:
client2@mail.com New password: LwrWpt4ybPxb

[2011-10-11 11:30:59][INFO] ==> STEP 3: Change password for users...
[2011-10-11 11:31:09][INFO] Hosting Panel User: mail1@domain.com New password: xtV2hsPy1Drj
[2011-10-11 11:31:15][INFO] Hosting Panel User: user1@
domain2.com New password: NZGheFAsHTFn
[2011-10-11 11:31:17][INFO] Hosting Panel User: user1@domain3.tld New password: Pg7bgQ3hTrCx
[2011-10-11 11:31:18][INFO] Hosting Panel User: admin@gmail.com New password: nCkE17PhvG8h

[2011-10-11 11:31:18][INFO] ==> STEP 4: Change password for FTP users of domains...
[2011-10-11 11:31:20][INFO] FTP user ftp1 for domain
domain.com New password: 9cmlKwXKjfv7
[2011-10-11 11:31:22][INFO] FTP user ftp2 for domain
domain2.com New password: RZG9G7ZxbOVS
[2011-10-11 11:31:24][INFO] FTP user ftp3 for domain
domain3.com New password: 5VKX83JwAb47
[2011-10-11 11:31:26][INFO] FTP user ftp4 for domain
domain4.com New password: md3XuAfxgLAa

[2011-10-11 11:31:26][INFO] ==> STEP 5: Change password for additional FTP accounts...
[2011-10-11 11:31:28][INFO] Domain:
domain4.com Additional FTP account: addftp1 New password: 5gsVrBlW8jjs

[2011-10-11 11:31:28][INFO] ==> STEP 6: Change password for mail accounts...
[2011-10-11 11:31:29][INFO] Mail account: justemail@
domain.com New password: Rgfi3SJTTkps
[2011-10-11 11:31:30][INFO] Mail account: justEmail@
domain2.com New password: OQcr9VtxOyGc

[2011-10-11 11:31:30][INFO] ==> STEP 7: Change password for web users of domains...
[2011-10-11 11:31:31][INFO] Web user wu1 for domain
domain2.com New password: wrBX6dChkUXG
[2011-10-11 11:31:33][INFO] Web user wu2 for domain
domain2.com New password: 870jUPoN06qc

[2011-10-11 11:31:33][INFO] ==> STEP 8: Change password for admin...
nohup: redirecting stderr to stdout
mysqld_safe[4677]: started
mysqld_safe[4696]: ended
[2011-10-11 11:31:55][INFO] Admin new password: ngtt5PmQfcgW

Found errors: 0; Found Warnings: 0

PBA-S 细则

如果您使用 PBA-S 4.1.x 或以前的版本与 Parallels Plesk Panel 10.x 或之前的版本可使用以下说明。 而且如果您使用 PBA-S 4.2,该说明也只能用于 Parallels Plesk Panel 11.x 之前的版本。

如果 Plesk Panel 作为 Plesk 节点在 Parallels Business Automation 中注册 - 标准,使用 plesk_password_changer 脚本(以上所示)重设密码后,将会影响Plesk 与 PBA-S 之间的集成。 
为了恢复与 Plesk 的集成,您需要在 PBA-S 管理节点运行  reset_plesk_passwords.pl 脚本。 此脚本将会更改存储于 PBA-S 数据库中的 Plesk 密码以及用于连接 Plesk 节点的 admin 密码。

Reset_plesk_passwords 有两个执行模式:

- without --process 参数脚本将会查看 CSV 文件内的数据一致性并显示将在  aspc 数据库(并未真正执行)中执行的查询。
- with --process 参数将执行 Plesk 密码更改的必要查询。

使用:
 
# perl reset_plesk_passwords.pl  --hw_ip=<plesk node IP address> --file=<output CSV file generated by plesk_password_changer.php>
 
此脚本的输出信息如下:
 
Input parameters: hw_ip=>10.52.53.101, hw_id=>, file=>new.csv, process=>
Running in debug mode, use --process parameter to alter DB
Processing client(s)...
No entities of type client found in CSV file!
Processing customer(s)...
No entities of type customer found in CSV file!
Processing reseller(s)...
Following statements will be executed:
UPDATE `plesk_client_cache` SET `plesk_password` = 'sHMHLrDJA9KlQWE' WHERE `hw_id` = '10' AND `plesk_login` = 'pbas_client1' AND `type` = '1';
UPDATE `plesk_client_cache` SET `plesk_password` = 'aHkgsUyETsDKQWE' WHERE `hw_id` = '10' AND `plesk_login` = 'pbasclien2_gma_5com_1034' AND `type` = '1';
Processing domain(s)...
Following statements will be executed:
UPDATE `plesk_domain_cache` SET `plesk_password` = 'OMu8tNVUcSOF' WHERE `hw_id` = '10' AND `plesk_name` = 'pbasSub1.a10-52-53-101.qa.plesk.ru';
Processing admin...
Following statements will be executed:
UPDATE `hw` SET `root_password` = 'something' WHERE `hw_id` = '10';
Finished successfully
 
# perl reset_plesk_passwords.pl  --hw_ip=<plesk node IP address> --file=<output CSV file generated by plesk_password_changer.php> --process
 
此脚本的输出信息如下:
 
Input parameters: hw_ip=>10.52.53.101, hw_id=>, file=>new.csv, process=>1
Processing client(s)...
No entities of type client found in CSV file!
Processing customer(s)...
No entities of type customer found in CSV file!
Processing reseller(s)...
Processing domain(s)...
Processing admin...
Finished successfully
[root@a10-52-49-208 ~]#
 
而且您可不用向该脚本提供 Plesk 节点的 IP 地址而是来自 PBA-S 数据库的该 Plesk 节点的 ID。 
 
# perl reset_plesk_passwords.pl  --hw_id=<id> --file=<output CSV file generated by plesk_password_changer.php> --process
 

Attachments

a914db3fdc7a53ddcfd1b2db8f5a1b9c 29d1e90fd304f01e6420fbe60f66f838 85a92ca67f2200d36506862eaa6ed6b8 c796c01d6951fa24ed54c7f1111667c6 400e18f6ede9f8be5575a475d2d6b0a6 caea8340e2d186a540518d08602aa065 56797cefb1efc9130f7c48a7d1db0f0c bd7fc88cf1b01f097749ae6f87272128 0a53c5a9ca65a74d37ef5c5eaeb55d7f dd0611b6086474193d9bf78e2b293040 aea4cd7bfd353ad7a1341a257ad4724a 46a8e394d6fa13134808921036a34da8 01bc4c8cf5b7f01f815a7ada004154a2 514af229ae32522202a910a2649c80fb ed7be2b984f9c27de1d2dc349dc19c6d a766cea0c28e23e978fa78ef81918ab8 2a5151f57629129e26ff206d171fbb5f e335d9adf7edffca6a8af8039031a4c7 e8756e9388aeca36710ac39e739b2b37 ff5a00b8ead2e480367b019417a04207 742559b1631652fadd74764ae8be475e 8b661cab116c79dbe6c4ac5bbdf1c8cb 5ba46e1c6f0941983726f3f192a169fb 31017699f1904665788bf685dabf68e3

Email subscription for changes to this article