Created
January 17, 2019 23:28
-
-
Save galvarado/d6ee84fe738f641ad486491a7ef6099d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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