Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-17929

Fail to run 'groovysh' in CLI due to insufficient permission

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • cli
    • version 1.502

      1: verified that I am authenticated: java -jar jenkins-cli.jar -s http://myserver/jenkins who-am-i
      Authenticated as: myuser
      Authorities:
      authenticated
      2: tried to run a trivial script via groovysh and got an error
      java -jar jenkins-cli.jar -s http://myserver/jenkins groovysh 'jenkins.model.Jenkins.instance.pluginManager.plugins.each { println("${it.longName} - ${it.version}") };'
      Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
      at $Proxy2.main(Unknown Source)
      at hudson.cli.CLI.execute(CLI.java:271)
      at hudson.cli.CLI._main(CLI.java:417)
      at hudson.cli.CLI.main(CLI.java:322)
      Caused by: hudson.remoting.ProxyException: hudson.security.AccessDeniedException2: anonymous is missing the Administer permission

      The workaround is using command 'groovy' instead.

      java -jar jenkins-cli.jar -s http://localhost:8080/jenkins/ groovy test_script.gsh

      It's also discussed in group.[1]

      [1] https://groups.google.com/forum/#!msg/jenkinsci-users/Vb1p7tbWfQk/4vcVrHOC19MJ

          [JENKINS-17929] Fail to run 'groovysh' in CLI due to insufficient permission

          Meng Xin Zhu created issue -
          Daniel Beck made changes -
          Description Original: 1: verified that I am authenticated: java -jar jenkins-cli.jar -s http://myserver/jenkins who-am-i
               Authenticated as: myuser
              Authorities:
                  authenticated
          2: tried to run a trivial script via groovysh and got an error
            java -jar jenkins-cli.jar -s http://myserver/jenkins groovysh 'jenkins.model.Jenkins.instance.pluginManager.plugins.each { println("${it.longName} - ${it.version}") };'
          Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
          at $Proxy2.main(Unknown Source)
          at hudson.cli.CLI.execute(CLI.java:271)
          at hudson.cli.CLI._main(CLI.java:417)
          at hudson.cli.CLI.main(CLI.java:322)
          Caused by: hudson.remoting.ProxyException: hudson.security.AccessDeniedException2: anonymous is missing the Administer permission

          The workaround is using command 'groovysh' instead.

           java -jar jenkins-cli.jar -s http://localhost:8080/jenkins/ groovy test_script.gsh

          It's also discussed in group.[1]

          [1] https://groups.google.com/forum/#!msg/jenkinsci-users/Vb1p7tbWfQk/4vcVrHOC19MJ
          New: 1: verified that I am authenticated: java -jar jenkins-cli.jar -s http://myserver/jenkins who-am-i
               Authenticated as: myuser
              Authorities:
                  authenticated
          2: tried to run a trivial script via groovysh and got an error
            java -jar jenkins-cli.jar -s http://myserver/jenkins groovysh 'jenkins.model.Jenkins.instance.pluginManager.plugins.each { println("${it.longName} - ${it.version}") };'
          Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
          at $Proxy2.main(Unknown Source)
          at hudson.cli.CLI.execute(CLI.java:271)
          at hudson.cli.CLI._main(CLI.java:417)
          at hudson.cli.CLI.main(CLI.java:322)
          Caused by: hudson.remoting.ProxyException: hudson.security.AccessDeniedException2: anonymous is missing the Administer permission

          The workaround is using command 'groovy' instead.

           java -jar jenkins-cli.jar -s http://localhost:8080/jenkins/ groovy test_script.gsh

          It's also discussed in group.[1]

          [1] https://groups.google.com/forum/#!msg/jenkinsci-users/Vb1p7tbWfQk/4vcVrHOC19MJ
          Jesse Glick made changes -
          Labels New: lts-candidate
          Jesse Glick made changes -
          Assignee New: Jesse Glick [ jglick ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]
          Oliver Gondža made changes -
          Labels Original: lts-candidate New: 1.532.2-fixed
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 149226 ] New: JNJira + In-Review [ 193026 ]

            jglick Jesse Glick
            zxkane Meng Xin Zhu
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: