From 7d6eb40d13f738270b45fa15bda82aea512863bb Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 11 Apr 2025 00:58:25 +0800 Subject: [PATCH] Updated pwd reset --- manifest.jps | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/manifest.jps b/manifest.jps index bd36218..c223fec 100644 --- a/manifest.jps +++ b/manifest.jps @@ -257,17 +257,18 @@ actions: jps_log "INFO" "Changing password for user: ${settings.manage_username}" "password_change.log" - # Change password without logging to stdout - if echo "${settings.manage_username}:${globals.password}" | chpasswd; then + # Change password using echo and chpasswd + if echo "${settings.manage_username}:${globals.password}" | /usr/sbin/chpasswd; then jps_log "SUCCESS" "Password changed successfully for ${settings.manage_username}" "password_change.log" echo "Password changed for ${settings.manage_username} at $(date)" >> /home/jelastic/add-sftp-user-addon/logs/script_output.log + exit 0 else jps_log "ERROR" "Failed to change password for ${settings.manage_username}" "password_change.log" exit 1 fi jps_log "SUCCESS" "======== PASSWORD CHANGE COMPLETED ========" "password_change.log" - } &> /home/jelastic/add-sftp-user-addon/logs/password_change.log + } &>> /home/jelastic/add-sftp-user-addon/logs/password_change.log - if ("${response.exitStatus}" != "0"): return: passwordChangeError - return: passwordChangeSuccess