On a Jenkins machine that a colleague setup, I needed to ensure that I was able to login and make changes to the Jenkins instance.
In this instance we were actually using hudson.security.FullControlOnceLoggedInAuthorizationStrategy, so the login was open to the public. The only thing that would restrict access to this Jenkins instance would be the firewall – no problem.
The first thing to do is to check for that information in the config.xml file, which is in the Jenkins base directory. In some Jenkins instances, you might find some user information within that file; but the vast majority of user data is actually stored in a user directory one level above the Jenkins base dir.
SSH into the machine, to the Jenkins base dir and then into the users directory, you will find a list of directories for each user. You’ve got a couple of options now, the first would be to copy a colleagues directory and rename it as your own login user. cd into the newly created directory and locate the config.xml.
In there, modify the fullName as well as the emailAddress nodes in there. The final and most important thing is to setup a passwordHash. You might have your password hashed on another instance of Jenkins elsewhere, you can use that to copy it across. Alternatively, as Jenkins uses jbCrypt, which is a Java implementation of a Blowfish hashing code, you can create one manually.
Afterwards, you shouldn’t even need to restart Jenkins, but you’re going to be able to login to the Jenkins instance manually. With my AuthorizationStrategy, I had administrative privileges.