How to reset my jenkins user id and password - jenkins

Forgot my Jenkins User ID and password is there any way to uninstall and remove the backup completely so that I can reinstall Jenkins with new settings/configurations? I tried finding the config file so that I could altered the
<useSecurity>true</useSecurity>
but I couldn't find the config file.
I also tried removing the application including the cache but yet installing again it shows me the login window
enter image description here

Related

Jenkins asking to enter initialadminstration password when upgrading version

I am trying to upgrade Jenkins version and deployed jenkins.war to webapps folder.After restarting the tomcat server jenkins taking to initial set up to register admin user.But i have already users created and assigned with roles.How to skip the initial set up and to to login page instead.
Looks like loading variables from JNDI was removed in 2.332.
https://community.jenkins.io/t/jenkins-home-variable-not-read-in-2-332-1-running-in-apache-tomcat-9/1826/4
To get it working, add the below in tomcat/bin/setenv.sh. Replace the path according to your directory structure
export JENKINS_HOME=/apps/jenkins

XCode - GitHub ´SecureTransport error: I/O error. (-1)´

I'm having an issue when pushing to my GitHub repo (it's an iOS app for iPhone). I haven't had any problem doing this in the last few years. However, without changing anything related to the connection between XCode and GitHub, now I get this error message:
I've checked and all my credentials are up to date, the project is working fine, and I'm able to do commits, but when I do the push. The error appears and no push is done.
Furthermore, I've tried pushing other projects and there is no problem. Also, the push size is not that big.
What should I do to solve this error? I'm using the Source Control functionality of XCode.
When doing the push through command line (terminal), I found out that the error was produced due to a file that had a size of +100MB. I had to remove it and everything went fine.
Remark: That file was a pod library. So, be careful when pushing all your project. At the end, to backup the whole project you just need the podfile, as it is the one you use to install pod libraries.
I had same issue cause of selecting different origin, select default origin and Source Control > Push and select Origin in dropdown then push
I was having this issue then I used terminal and I realised that I needed to add my personal access token to my push request.
To get your personal access token, go to your github.com account->profile->Settings->Developer settings->Personal access tokens and generate a new token. Save somewhere safe as you can only copy once else you have to regenerate again
Initialising and committing your project locally. Skip if you've already committed
cd <directory of your project>
git init
git add .
git commit -m "type in a commit message here"
Pushing to your remote project on github.com
git remote add origin https://github.com/AccountName/testProject.git
git push -u origin master
It'll prompt you to enter Username & Password but password should be your token already created on github prior and NOT your account password
Username for 'https://github.com': <your username here>
Password for '<your username is shown here>': <access token here>

Why does Jenkins Credentials show "This ID is already in use"

I am doing a fresh install of Jenkins on an EC2 Ubuntu AMI. I install the default set of plugins (which includes the Credentials plugin). After logging in, I go to the Credentials link, select the default Global domain, and add a new credential. After I add a username with password credential (leaving the ID blank), I am able to add it. But then when I click on Update, I see "This ID is already in use" message under the ID field. I have tried this with Jenkins 2.23, 2.21, and 2.18 and I keep seeing the same message. Anyone know why this could be happening? Credentials Error Message
It turns out that the problem went away once I changed the version of one of the plugins. The Credentials Plugin version 2.1.5 was showing this problem. Once I changed the version of that particular plugin from 2.1.5 to 2.1.4, the problem went away and I haven't seen it since.
Should be fixed with (not released yet) v2.1.6: https://issues.jenkins-ci.org/browse/JENKINS-38861
EDIT: New version v2.1.6 was released and fixes the problem for me.

Jenkins: How to Change LDAP Password

My institution requires me to periodically change my LDAP password.
In the past, I was able to perform the following steps to change my password:-
Create a Base64 encoded password at http://www.base64encode.org/
Edit /var/lib/jenkins/config.xml and change <managerPassword/>.
However, the recent version of Jenkins no longer use <managerPassword/>. Instead, I'm seeing <managerPasswordSecret/>.
I'm not sure how to generate the new secret password, so I did the following:-
Backup /var/lib/jenkins/config.xml first.
Edit /var/lib/jenkins/config.xml and change <useSecurity/> to false.
Restart Jenkins service.
Go to Jenkins.
Enable LDAP Security.
Enter new LDAP password.
Save it.
Open up /var/lib/jenkins/config.xml and copy <managerPasswordSecret/>.
Restore backup config file.
Replace <managerPasswordSecret/> with the new value.
This is incredibly convoluted.
Is there a more straightforward way for me to maintain my LDAP password change in the future?
Thanks much!
None of the above solutions worked for me with a newer version of Jenkins (2.78). What did work was putting the managerPasswordSecret in without any encryption. Once I ran Jenkins, the password got encrypted for me.
You can still use <managerPassword>.
Generate the new encoded password with
perl -e 'use MIME::Base64; print encode_base64("yourNewPassword");'
In your config.xml, find <hudson>/<securityRealm>/<managerPasswordSecret>. Change <managerPasswordSecret> to <managerPassword> (both before and after) and put the encoding from #1 between them. Save the file.
Restart jenkins
Login and using the UI, reset the LDAP Manager password to the same yourNewPassword. config.xml should now be back to <managerPasswordSecret>.
If you are paranoid (like me), restart jenkins again to use the newly modified config.xml.
I was trying to do same thing and this is simple solution (use from Jenkins console):
import com.trilead.ssh2.crypto.Base64;
import javax.crypto.Cipher;
import jenkins.security.CryptoConfidentialKey;
import hudson.util.Secret;
CryptoConfidentialKey KEY = new CryptoConfidentialKey(Secret.class.getName());
Cipher cipher = KEY.encrypt();
String MAGIC = "::::MAGIC::::";
String VALUE_TO_ENCRYPT = "";
println(new String(Base64.encode(cipher.doFinal((VALUE_TO_ENCRYPT + MAGIC).getBytes("UTF-8")))));
Decoding is simpler:
println(hudson.util.Secret.decrypt(HashFromConfigXmlHere));
Edit your config.xml file by hand.
If your Jenkins uses a <managerPasswordSecret> set of tags, put the new plain text password in there and Jenkins will read it. Once Jenkins starts up, go to the Configure System > Configure Global Security page and click Save. That will update that field with the encrypted version.
The current easiest and fastest solution (just worked for me) is from Cloudbees: simply enter the new password into the password field in the config.xml as plain text (not encrypted) then Jenkins will read that correctly. Once you start Jenkins and just re-save the Manage Jenkins -> Configure Global Security page
https://support.cloudbees.com/hc/en-us/articles/221230028-Changing-LDAP-Password
I tried solution provided by #alkuzad and its working fine. Just to clarify that you can't use Jenkins web Console when LDAP user password is expired. So what I did is as follow (I have groovy script plugin in Jenkins. I also provided run script access to anonymous user - not a good idea but it's the way I initially found to resolve this recurring issue).
Downloaded jenkins-cli.jar
put above code in GroovyPasswordClass.txt (not to forget using new password in place of VALUE_TO_ENCRYPT in code)
start jenkins server (its requirement to have jenkins running)
run below command from command prompt
java -jar jenkins-cli.jar -s groovy GroovyPasswordClass.txt
This will print encrypted password.
Better Option
Well, later I found better way to do authentication if directory service provider is MS Active Directory. In that case instead of LDAP plugin, I used Active Directory plugin for authentication. This I found better because
1) Response is faster when use Active directory plugin instead of generic LDAP protocol based plugin
2) Active Directory plugin uses user data with which Jenkins service was started and no need to configure any user account in Jenkins. So you will never have situation that your Jenkins login not working because user configured for ldap has expired password.
Hope this will help others trying to resolve this issue.

Cannot connect to valid github repository

I have read/write access to a private repository owned by someone else but RubyMine cannot connect to the Git URL. Workflow:
Open RubyMine
Click on "Check out from source control"
Select Git
Enter URL, click "Test", and Test fails
I'm using OSX Lion and my Github credentials have already been saved. I've tried connecting to a few other github URLs on the "Explore" tab at github.com and I haven't had any trouble. Suggestions?
I was able to fix this by following the tutorial on GitHub, Generating SSH Keys, exactly. I also deleted any existing keys in my account before adding a new one. In the RubyMine dialog, I pasted the ssh link to my repository instead of the HTTP one. Hope this helps someone else.
https://help.github.com/articles/generating-ssh-keys
I would recommend to create an issue in the RubyMine bugtracker and attach the log file there (Help -> Reveal Log in Finder). Maybe it is a bug in RubyMine support of Git over HTTP.
Meanwhile as a workaround you may use SSH, as adviced by user1836351.
Another workaround is specifying your credentials in the ~/.netrc file.
Example of the file content:
machine github.com
login yourname
password yourpassword

Resources