32

I just installed Jenkins in my machine running Ubuntu.

But when I access http://localhost:8080/ jenkins asks me for my username and password... but I have no idea what they are!

How can I log in Jenkins? (Sorry for the noob question, first time using Jenkins)

Any help is welcome!

Edit: So far I got this:

I can remove security by changing the config.xml setting

<useSecurity>true</useSecurity> 

to

<useSecurity>false</useSecurity> 

And now I can access my Jenkins... But I still dont know how to create a user =/

Leandro Borges Ferreira
  • 12,422
  • 10
  • 53
  • 73

8 Answers8

25

in jenkins go to Manage Jenkins > Configure Global Security and select the "Enable Security" check box. select "Jenkins Own User Database" for the security realm and then select "Logged in Users can do anything" or a matrix based strategy (If you have multiple users with different permissions) for the Authorization.

Inforedaster
  • 1,260
  • 1
  • 23
  • 39
11

Once you log in Jenkins as admin, Manage Jenkins > Configure Global Security and select the "Enable Security" check box. select "Jenkins Own User Database" for the security realm under access control and then select "Logged in Users can do anything" under Authorization and Save it.

click on Manage jenkins>>Manage User >> Create User Complete the details.

Kanav
  • 135
  • 1
  • 3
3

Jenkins asks me for my username and password... but I have no idea what they are!

It depends how you configured Jenkins Access Control/Security Realm in your Configure Global Security page which determines the user authentication method, whether to use Jenkins own independent user database or external database (such as LDAP, Active Directory, Unix NIS, etc.).

If its using its own database, you can try to decrypt Jenkins passwords from credentials.xml. Otherwise disable useSecurity in your config.xml file, restart Jenkins and follow the steps. You should be asked to provide the initial password from the initialAdminPassword file (if you don't, make sure you've changed the right file and restarted Jenkins correctly).

To create user, you need to go to select your authentication method in Configure Global Security and create user either externally or if you've selected Jenkins’ own user database and tick Allow users to sign up, then hit Save button which would allow you to create user from the Jenkins interface.

kenorb
  • 155,785
  • 88
  • 678
  • 743
  • which jenkins version ? of it since Jenkins 2.0 you can create user and password during the installation of you jenkins – Inforedaster May 29 '18 at 13:49
  • It's 2.x, but user creation in Jenkins depends how on your _Security_ settings. You can create during the installation, but if you're working with the existing instance, it depends which database you use. – kenorb May 29 '18 at 18:45
2

Login to your Jenkins server via web URL. (http://jenkins_ip or jenkins_url:8080) Jenkins >> Manage Jenkins >> Manage Users >> Create User >> Provide the username, password, email & click on Create User.

To edit or reset or modify the password of the Jenkins' own user database users, Jenkins >> Manage Jenkins >> Manage Users >> Click the user-id from the existing user list >> Configure >> Save

Sandy
  • 946
  • 11
  • 14
1

You should find a file in secrets folder called initialAdminPassword with the info

kimy82
  • 4,069
  • 1
  • 22
  • 25
1

Steps to create a new user

  1. Login into Jenkins
  2. Go to Manage Jenkins
  3. Go to Create Users
  4. Enter all the details – Username, Password, Confirm Pwd, FullName, Email
  5. Select Create User
Megha Chovatiya
  • 483
  • 5
  • 8
1

This LINK has detailed steps on how to create Jenkins user. Here is the summary:

After setting

<useSecurity>false</useSecurity> 

Restart Jenkins:

sudo systemctl restart jenkins

  1. Click on People on the left-hand navigation menu.
  2. Click on the Admin. (Skip and move on to step 4 if you don't have any user).
  3. Delete the user account.
  4. Navigate to Jenkins / Manage Jenkins.
  5. Click on Configure Global Security
  6. Check the Enable Security check box. (If you don't have this item, skip and move on to next and you will able to create/add user)
  7. Under Security Realm, select Jenkins’ own user database
  8. In the Authorization section, select Logged-in users can do anything.
  9. Unselect Allow anonymous read access.
  10. Click Save to save your changes.
yantaq
  • 3,968
  • 2
  • 33
  • 34
  • You should enable user registration and allow logged in users to do anything. This way you can register a new user and have access to all actions immedately. Disable user registration afterwards. – Marcell Jul 25 '22 at 12:17
0

By default Jenkins uses it's own database for user management.

Go to People on Jenkins dashboard to see Users that you have, if you are not able to find an option to add user there, don't be disheartened, read on.

Go to Manage Jenkins and scroll down to bottom, second last option should be Manage Users.

By default every logged-in user can do anything, to change this, go to Manage Jenkins -> Configure Global Security -> Access Control -> Authorization -> Matrix-based security

AT THIS POINT IF YOU DON'T KNOW WHAT TO DO, PLEASE DON'T MAKE ANY CHANGES. DON'T SAVE OR APPLY.

Vishwa
  • 67
  • 1
  • 12