Answers: <p>This is covered <a href="https://www.jenkins.io/doc/book/system-administration/authenticating-scripted-clients/" rel="nofollow noreferrer">in the documentation</a>.  In short, if you are triggering via HTTP, you need to generate an authentication token and use it with HTTP Basic auth, for instance:</p>
  <pre><code>curl -X POST -L --user your-user-name:apiToken https://jenkins.example.com/job/your_job/build
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2022-04-14T19:39:15.550Z
Answers: 2022-04-14T19:39:15.550Z
Answers: jayhendren
Body: <p>As far as I understand, using the Linux CLI, builds can be triggered remotely using the curl command and the following URL syntax:</p>
  <p>&lt;JENKINS_URL&gt;/job/&lt;JOB_NAME&gt;/build?token=&lt;TOKEN_NAME&gt;</p>
  <p>Example:</p>
  <pre><code>$ curl http://localhost:8080/job/MyJob/build?token=my-token
  </code></pre>
  <p>However, when I run the command, I receive the following:</p>
  <pre><code>Authentication required
  &lt;!--
  --&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  <p>Is authentication done using the CLI or the Jenkins web interface? How do I authenticate?</p>
  
Tags: <jenkins><authentication>
Title: In Ubuntu, how do I authenticate to trigger a Jenkins job remotely using the CLI?
UserDisplayName: Omar Shazly
ThreadText: # In Ubuntu, how do I authenticate to trigger a Jenkins job remotely using the CLI?
  
  (Asked by: username_0 on 2022-04-13)
  
  As far as I understand, using the Linux CLI, builds can be triggered remotely using the curl command and the following URL syntax:
  
  <JENKINS\_URL>/job/<JOB\_NAME>/build?token=<TOKEN\_NAME>
  
  Example:
  
  ```
  $ curl http://localhost:8080/job/MyJob/build?token=my-token
  
  ```
  
  However, when I run the command, I receive the following:
  
  ```
  Authentication required
  <!--
  -->
  </body></html>
  
  ```
  
  Is authentication done using the CLI or the Jenkins web interface? How do I authenticate?
  
  **Tags:** jenkins, authentication
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-04-14. Score: 1
  
  This is covered [in the documentation](https://www.jenkins.io/doc/book/system-administration/authenticating-scripted-clients/). In short, if you are triggering via HTTP, you need to generate an authentication token and use it with HTTP Basic auth, for instance:
  
  ```
  curl -X POST -L --user your-user-name:apiToken https://jenkins.example.com/job/your_job/build
  
  ```
  
  
  ---
  
  