Change user password from within Rundeck
1 min readJun 21, 2020
Since Rundeck uses a static file to manage users and their passwords, I created a tiny little script that you can use as a job step that updates a user password.
The job will accept three Options, oldpw, newpw, and newpw_confirm.
The workflow should contain one inline script step, configured as follows:
#!/bin/bash
USERNAME=$RD_JOB_USERNAME
OLDPW=$RD_OPTION_OLDPW
NEWPW=$RD_OPTION_NEWPW
NEWPW_CONFIRM=$RD_OPTION_NEWPW_CONFIRMif [[ $NEWPW == $OLDPW ]]; then
echo "[Warning:] New password is the same as old password"if [ "$NEWPW" == "$NEWPW_CONFIRM" ]; then
sed -i "/^$USERNAME/ s/$OLDPW/$NEWPW/g" /etc/rundeck/realm.properties
else
echo Passwords do not match
exit 1
fi
Node should be set as local.
That’s it, you should be good to go!