Create new user in jenkins

To create a new user in Jenkins, you can follow these steps:

Method 1: Using the Jenkins Web Interface

  1. Log in to your Jenkins instance as an administrator.
  2. Click on the "Configure Jenkins" link in the left-hand menu.
  3. Scroll down to the "Security" section.
  4. Click on the "Users" link.
  5. Click on the "New User" button.
  6. Fill in the required information for the new user, including:
    • Username: Enter a unique username for the new user.
    • Full name: Enter the full name of the new user.
    • Email: Enter the email address of the new user.
    • Password: Enter a password for the new user.
    • Confirm password: Re-enter the password to confirm.
  7. Click the "Create" button to create the new user.

Method 2: Using the Jenkins CLI

  1. Open a terminal or command prompt and navigate to the Jenkins CLI directory.
  2. Run the following command to create a new user:
    java -jar jenkins-cli.jar create-user <username> <full-name> <email> <password>

    Replace <username>, <full-name>, <email>, and <password> with the desired values for the new user.

For example:

java -jar jenkins-cli.jar create-user johnDoe John Doe [email protected] mysecretpassword

This will create a new user named "johnDoe" with the specified full name, email address, and password.

Method 3: Using the Jenkins API

  1. Open a web browser and navigate to the Jenkins API page.
  2. Click on the "Create User" button.
  3. Fill in the required information for the new user, including:
    • username: Enter a unique username for the new user.
    • full_name: Enter the full name of the new user.
    • email: Enter the email address of the new user.
    • password: Enter a password for the new user.
  4. Click the "Create" button to create the new user.

Note: You can also use the Jenkins API to create a new user using a JSON payload. For example:

curl -X POST \
  http://your-jenkins-instance.com/api/users \
  -H 'Content-Type: application/json' \
  -d '{"username":"johnDoe","fullName":"John Doe","email":"[email protected]","password":"mysecretpassword"}'

Replace your-jenkins-instance.com with the URL of your Jenkins instance.