Change all FTP passwords for Plesk (Linux) via SSH

This article will go over changing all Plesk FTP passwords for a server in one command via SSH. The passwords will be 12 characters long containing numbers, letters, symbols, as well as upper and lowercase letters.

  1. SSH [Mac | Windows] into the server as the 'root' user.
  2. Run the following command via SSH:
  3. 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 8 -base64)"; /usr/local/psa/admin/bin/usermng –set-user-passwd –user=$i; echo "$i:$PSA_PASSWD" >> ftp_passwords; done

  4. You may receive an error but the command successfully completed. There will now be a file in the directory you ran the command in (in most cases /root) called ftp_passwords. This file has the username and new, secure passwords for all FTP accounts on the server.
  5. Alternatively, you can view the new FTP passwords by running the following command at the prompt:

mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e 'select sys_users.login, accounts.password from sys_users, accounts where sys_users.account_id=accounts.id';