• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

How to create Jenkins user by command line and GUI

November 29, 2018 by Sharad Chhetri

In our previous post, we did installation of Jenkins on Ubuntu 18.04 LTS server. Now in this post we will learn to create Jenkins user by command line and GUI method.

In this article, we will use the term JENKINS_URL, it means the URL of your Jenkins server. For example – http://localhost:8080 or https://localhost. Therefor, replace the value of JENKINS_URL with your Jenkins URL wherever you find in this post.

Here, we are creating user in ‘Jenkins’ own user database’. In ‘Configure Global Security’ page of Jenkins at ‘Access Control’ you will find 4 options for ‘Security Ream’, “Jenkins’ own user database” is one of them.
Note: In Web browser JENKINS_URL/configureSecurity/ will open the “Configure Global Security” page. Change value of JENKINS_URL with your jenkins http or htps url.

Screenshot of ‘Configure Global Security’:
jenkins

Create new Jenkins user through command line(CLI)

We will run the command line from Jenkins server itself. We can also run the command remotely too,for this you have to download ‘jenkins-cli.jar’ in your remote system.

Creating Jenkins user through command line is very useful, you can easily automate this step by writing your own script.

  1. Login to your Jenkins Server through ssh
  2. Download jenkins-cli.jar:
    Syntax: wget JENKINS_URL/jnlpJars/jenkins-cli.jar
    Example:

    wget http://localhost:8080/jnlpJars/jenkins-cli.jar

    After downloading, next step is to execute the command.

  3. Create Jenkins user by cli:
    You should run this command from location where you have downloaded jenkins-cli.jar file.
    Syntax:echo 'jenkins.model.Jenkins.instance.securityRealm.createAccount("NEW_USER", "NEW_USER_PASSWORD")' | java -jar ./jenkins-cli.jar -s "JENKINS_URL" -auth JENKINS_ADMIN_USER:JENKINS_ADMIN_PASSWORD -noKeyAuth groovy = –

    Here,
    NEW_USER: New Jenkins user name
    NEW_USER_PASSWORD: Password of new Jenkins user
    JENKINS_URL: Your Jenkins Server URL
    JENKINS_ADMIN_USER: Jenkins admin user name
    JENKINS_ADMIN_PASSWORD: Jenkins admin password

    Example:

    echo 'jenkins.model.Jenkins.instance.securityRealm.createAccount("test", "test123")' | java -jar ./jenkins-cli.jar -s "http://localhost:8080" -auth admin:admin123 -noKeyAuth groovy = –

Through command line created Jenkins user you can verify in console
, here is its URL path JENKINS_URL/securityRealm/.

Create Jenkins user by GUI

From GUI(Graphical User Interface), you can easily create Jenkins User.

Navigation Path:
Manage Jenkins >> Manage Users >> Create User. Fill the form and click ‘Create User’ button.

create Jenkins user

create Jenkins user

create Jenkins user GUI

create Jenkins user

create Jenkins user GUI

Rather going through with each click-click way, you can directly open JENKINS_URL/securityRealm/ this URL path for user creation console.

Creating the Jenkns User is easy and one of the important part of security also. It is recommended to safe Jenkins admin user, create new user and grant necessary permission to it.

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. Managing Jenkins plugins from command line and GUI
  2. How to manage Jenkins Credentials
  3. How to setup Jenkins Credentials for Git repo access
  4. Install and setup maven in Linux for Jenkins
  5. How to install Jenkins on Ubuntu 18.04 LTS server
  6. create and delete user in Red Hat and CentOS
  7. Create and Remove AWS EC2 key pair by using command line
  8. Linux: Set user password by using encrypted password in command
  9. Create single node Virtual Machine with Vagrant
  10. Create multiple virtual machine with one Vagrantfile

Filed Under: Linux, Devops, Jenkins Tagged With: automation, devops, jenkins

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

How to increase Password Expire date without resetting the password

Convert video file into gif file through command line in linux

How to reset forgot root password in CentOS 6.x and Redhat 6.x

How to zip the directory in linux with command line

How to hide php version information in header

Replace keyword with its filename without extension : bash script

Learn Linux Date Command With Examples

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ·
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy