Jenkins

Create a New User in Jenkins

A Jenkins user refers to a specific user account that can access and use the Jenkins cluster to manage and automate the various tasks related to building, testing, and deploying software applications.

Among the actions that a Jenkins user can perform include:

  • Setting up and configuring Jenkins on a server.
  • Creating and managing the build jobs in Jenkins to automate the build, test, and deployment process.
  • Monitoring the status of builds and tests, and receiving notifications when the build or test failures occur.
  • Analyzing the build logs and test results to identify the problems and debug issues.
  • Integrating Jenkins with the other tools and services such as source control systems, test frameworks, and deployment tools.

In this tutorial, you will learn how to configure a new user in the Jenkins cluster in a few simple steps.

Create a New User in Jenkins in the Administrative Dashboard

To set up a new user in Jenkins, start by logging into your Jenkins controller.

http://localhost:8080

Once logged in, navigate to the Jenkins dashboard and select “Manage Jenkins”.

Under the Security Interface, select “Manage Users”.

Finally, select “Create User” to add a new user to the Jenkins server.

In the “Create User” window, add the details of the user that you wish to create such as the target username, password, full name, and email address.

Once satisfied with the details, click “Create User” to add the specified username to the server.

You can then view the list of available users in the server by navigating to Manage Jenkins -> Manage Users.

Another way to view the available users in the server is to use the “People” section in the Jenkins dashboard.

The user list is as follows:

Create a New User in Jenkins Using CLI

You can also add a new user to the Jenkins server using the command line by running the command as shown in the following:

echo 'jenkins.model.Jenkins.instance.securityRealm.createAccount("linuxhint2", "password123")' | java -jar .\jenkins-cli.jar -s "http://localhost:9001" -auth root:password groovy =

Since there is no direct command to add a new user to the Jenkins server, we can use a groovy script to allow Jenkins to create a new user from the terminal.

The previous command creates a new user with the “linuxhint2” username and the “password123” password.

You can then go to the Jenkins dashboard – People to view the list of available users.

Conclusion

We discussed how to use the Jenkins Administrative dashboard to create a new Jenkins user. We also discussed how to use a Groovy script to invoke the user creation in Jenkins from the command line.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list