Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
username="myusername"
hash="$(echo -n 'thenewpass{s4lt}' | sha256sum | awk '{print $1;}')"
echo "Changing password for $username"
echo "Password encrypted with SHA-256"
sed -i -E "s/(<passwordHash>.+)/<passwordHash>s4lt:$hash<\/passwordHash>/" /var/lib/jenkins/users/$username/config.xml
echo "Replaced succesfully, restarting jenkins service..."
service jenkins restart
echo "Jenkins restarted"
service jenkins status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.