• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
sharadchhetri.com

sharadchhetri.com

Linux,Cloud Computing And DevOps

  • Home
  • Linux
  • CloudComputing
    • Introduction Cloud Computing
    • Amazon AWS
  • Free E-Books
  • About Me

How to create Jenkins user by command line and GUI

November 29, 2018 by Sharad Chhetri Leave a Comment

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.

Do'nt be greedy, share the knowledge!

  • Click to share on Facebook (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)

Related

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

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow Us

  • Facebook
  • Twitter
  • GitHub
  • YouTube

Recent Posts

  • How to install Java (OpenJDK) on Ubuntu Linux
  • How to install Groovy on Ubuntu 20.04 LTS
  • How to Disable selinux in Red Hat or CentOS
  • How to remove date from WordPress Post URL
  • How to install Mariadb 10.4 server on CentOS 8 / RHEL 8

Top Posts & Pages

  • How to delete mail queue in Postfix
  • How to fix read only USB pen drive in Ubuntu
  • 4 different commands to check the load average in linux
  • How to start / stop / restart / reload iptables on CentOS 7 / RHEL 7
  • How to set hostname and FQDN on CentOS 7 and RHEL 7
  • How to find absolute path of command on Linux / Unix : which command
  • How to create Jenkins user by command line and GUI
  • How to install MySQL Server 5.6 on CentOS 7 / RHEL 7
  • How to setup Jenkins Credentials for Git repo access
  • make command not found in linux CentOS Red Hat ubuntu Debian

DevOps Posts

  • vagrant cloud flow

    Install Vagrant on Ubuntu and create first VM

  • git jenkins credential github

    How to setup Jenkins Credentials for Git repo access

  • terraform

    how to install terraform in Linux : CentOS-Ubuntu

  • docker image

    How to create Ubuntu docker base image

  • Install Ansible on Ubuntu / CentOS / RHEL

Footer

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Sharad Chhetri is an experienced Linux - Cloud Engineer & freelancer. Working on Open Source Technology since RHEL 4.0 (Red Hat Enterprise Linux). He loves sharing the knowledge which earned from real scenarios. Don't be surprised if you find him in technology seminars and meetup groups. You can contact him on email for freelance projects at admin@sharadchhetri.com. Read More…

Tags

Amazon AWS apache automation awk bash script CentOS centos 7 debian devops docker freebsd ftp ghost git grep hostname jenkins kvm linux linux command linux commands MariaDB Server mysql Nagios nginx Octopress owncloud Owncloud 6 php postfix postgres python Red Hat rpm sed selinux ssh swap ubuntu user management vagrant varnish virtualbox vsftp wordpress

Recent Comments

  • Sharad Chhetri on How to install own git server with ssh and http access by using gitolite and gitweb in CentOS
  • Slacker on How to fix read only USB pen drive in Ubuntu
  • Possum on setfacl: Option -m: Invalid argument near character 3
  • UnixNewbie on How to start / stop / restart / reload iptables on CentOS 7 / RHEL 7
  • sop on How to set hostname and FQDN on CentOS 7 and RHEL 7
  • sunil on Managing Jenkins plugins from command line and GUI
  • Corneliu Florea on How to fix read only USB pen drive in Ubuntu
  • Corneliu Florea on How to fix read only USB pen drive in Ubuntu

Copyright © 2009 - 2021 · All Rights Reserved sharadchhetri.com · · Privacy Policy ·
· sitemap.xml · ·The content is copyrighted to sharadchhetri.com and may not be reproduced on other websites without our permission. ·

Copyright © 2021 · Genesis Sample on Genesis Framework · WordPress · Log in