v-change-database-password-for-wordpress: fixing a bug in temporary password storage

This commit is contained in:
Peca 2025-07-16 17:53:38 +02:00
commit a976a3bc3f
2 changed files with 8 additions and 3 deletions

View file

@ -51,7 +51,9 @@ for user in $(grep '@' /etc/passwd |cut -f1 -d:); do
done done
# cat /root/remember-db-user-pass.txt # cat /root/remember-db-user-pass.txt
if [ -f "/root/remember-db-user-pass.txt" ]; then
rm /root/remember-db-user-pass.txt rm /root/remember-db-user-pass.txt
fi
#----------------------------------------------------------# #----------------------------------------------------------#
# Vesta # # Vesta #

View file

@ -94,8 +94,11 @@ if [ -f "/home/$user/web/$domain/public_html/wp-config.php" ]; then
echo "DB name: $db_name" echo "DB name: $db_name"
echo "DB user: $db_user" echo "DB user: $db_user"
echo "New DB password: $new_password" echo "New DB password: $new_password"
if [ $found_existing_password -eq 0 ] && [ -f "/root/remember-db-user-pass.txt" ]; then if [ $found_existing_password -eq 0 ]; then
touch /root/remember-db-user-pass.txt
echo "$db_user:$new_password" >> /root/remember-db-user-pass.txt echo "$db_user:$new_password" >> /root/remember-db-user-pass.txt
chown root:root /root/remember-db-user-pass.txt
chmod 600 /root/remember-db-user-pass.txt
fi fi
/usr/local/vesta/bin/v-change-database-password "$user" "$db_name" "$new_password" /usr/local/vesta/bin/v-change-database-password "$user" "$db_name" "$new_password"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -126,4 +129,4 @@ fi
# Logging # Logging
log_event "$OK" "$ARGUMENTS" log_event "$OK" "$ARGUMENTS"
exit exit 0;