# Disable Jenkins CLI

**URL:** <https://community.jenkins.io/t/disable-jenkins-cli/12621>\
**Category:** Using Jenkins\
**Created:** [February 20, 2024, 12:58pm UTC](https://community.jenkins.io/t/disable-jenkins-cli/12621 "2024-02-20T12:58:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![harsha\_987](https://avatars.discourse-cdn.com/v4/letter/h/a4c791/32.png) [@harsha\_987](https://community.jenkins.io/u/harsha_987)\
**Post date:** [February 20, 2024, 12:58pm UTC](https://community.jenkins.io/t/disable-jenkins-cli/12621/1 "2024-02-20T12:58:11Z")

</div>

Jenkins setup: Jenkins version : 2.443

How can we disable Jenkins CLI without having to use the groovy script provided here .

> <https://github.com/jenkinsci-cert/SECURITY-3314-3315/blob/c03dab221a7359ef2d28e76b1e945145deb607bf/disable-cli.groovy>

When we use the script from above, we are seeing some errors which we want to avoid.

If there is any workaround please do share.

Thanks.

---

<div class="post-metadata">

**Author:** ![mawinter69](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/mawinter69/32/1625_2.png) [@mawinter69](https://community.jenkins.io/u/mawinter69)\
**Post date:** [February 20, 2024, 2:03pm UTC](https://community.jenkins.io/t/disable-jenkins-cli/12621/2 "2024-02-20T14:03:03Z")

</div>

Jenkins 2.443 is not affected by the security vulnerability. So you can just remove the init.groovy script.

---

<div class="post-metadata">

**Author:** ![harsha\_987](https://avatars.discourse-cdn.com/v4/letter/h/a4c791/32.png) [@harsha\_987](https://community.jenkins.io/u/harsha_987)\
**Post date:** [February 20, 2024, 2:24pm UTC](https://community.jenkins.io/t/disable-jenkins-cli/12621/3 "2024-02-20T14:24:24Z")

</div>

I could remove the init.groovy, but was hoping for any other way to disable jenkins cli.

---

<div class="post-metadata">

**Author:** ![mawinter69](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/mawinter69/32/1625_2.png) [@mawinter69](https://community.jenkins.io/u/mawinter69)\
**Post date:** [February 20, 2024, 4:04pm UTC](https://community.jenkins.io/t/disable-jenkins-cli/12621/4 "2024-02-20T16:04:15Z")

</div>

You intend to disable the CLI permanently also the security issue is solved in the Jenkins version you’re using?

---

<div class="post-metadata">

**Author:** ![harsha\_987](https://avatars.discourse-cdn.com/v4/letter/h/a4c791/32.png) [@harsha\_987](https://community.jenkins.io/u/harsha_987)\
**Post date:** [February 21, 2024, 4:59am UTC](https://community.jenkins.io/t/disable-jenkins-cli/12621/5 "2024-02-21T04:59:29Z")

</div>

Yes I want to disable the Jenkins CLI permanently.  
Yes, I am using jenkins 2.443 which should not actually have any security issue.  
We personally would like jenkins to only work through GUI or API , so we are trying to remove the Jenkins CLI which uses jenkins-cli.jar to trigger builds etc.

---

<div class="post-metadata">

**Author:** ![mawinter69](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/mawinter69/32/1625_2.png) [@mawinter69](https://community.jenkins.io/u/mawinter69)\
**Post date:** [February 21, 2024, 9:22am UTC](https://community.jenkins.io/t/disable-jenkins-cli/12621/6 "2024-02-21T09:22:47Z")

</div>

I think the problem you have is this bug in Blue Ocean, which prevents that the script works.  
So you could uninstall Blue Ocean and use [pipeline-graph-view](https://plugins.jenkins.io/pipeline-graph-view/) instead. Blue Ocean is anyway in maintenance mode (so no new features are added and only bigger bugs are fixed afaik).

---

<div class="post-metadata">

**Author:** ![harsha\_987](https://avatars.discourse-cdn.com/v4/letter/h/a4c791/32.png) [@harsha\_987](https://community.jenkins.io/u/harsha_987)\
**Post date:** [February 21, 2024, 12:38pm UTC](https://community.jenkins.io/t/disable-jenkins-cli/12621/7 "2024-02-21T12:38:54Z")

</div>

Thanks for the suggestion, we will look into the plugin “pipeline-graph-view”. Looks like a good replacement.

Meanwhile I have tried below script in init.groovy to avoid errors:

```auto
def removal = { lst ->

lst.each { it -> if (it.getClass().name?.contains("CLIAction")) lst.remove(it) }

}

def j = jenkins.model.Jenkins.get();

removal(j.getExtensionList(hudson.cli.CLIAction.class))

//removal(j.getExtensionList(hudson.ExtensionPoint.class))

removal(j.getExtensionList(hudson.model.Action.class))

removal(j.getExtensionList(hudson.model.ModelObject.class))

removal(j.getExtensionList(hudson.model.RootAction.class))

removal(j.getExtensionList(hudson.model.UnprotectedRootAction.class))

//removal(j.getExtensionList(java.lang.Object.class))

removal(j.getExtensionList(org.kohsuke.stapler.StaplerProxy.class))

removal(j.actions)

```

Basically commenting the lines causing unnecessary errors.

Any insight on any issue that would come because of above commenting?
