In automation command line tools play an important role. Jenkins has an in-build Command line interface 'Jenkins-cli' Jar. Running Command line require proper authentication to the Jenkins server to execute the given commands. Authentication with an -auth option, takes a username:apitoken as an argument.
If you are observing 'ERROR: anonymous is missing the Overall/Read permission' means either you are not authorized or proper authentication is missing for user on Jenkins Server.
Ways to Authenticate to Jenkins Server via command Line CLI
Jenkins Authentication using username:token
java -jar jenkins-cli.jar [-s JENKINS_URL] -auth username:token command
-auth [ USER:SECRET ] :
Specify username and either password or API token (or load from them both from a file), for use with -http, or -remoting but only when the JNLP agent port is disabled. Passing credentials by a file is recommended.
Jenkins Load Authentication Data from File using '@'
java -jar jenkins-cli.jar [-s JENKINS_URL] -auth @/some/directory command
-auth [ @FILE ] :
Load username and password from a file, for use with -http, or -remoting but only when the JNLP agent port is disabled. Passing credentials by a file is recommended.
Jenkins Authentication using SSH Public Key in your Jenkins user account
We can either enter passphrase on promoting the error or we can pass it along with the command
java -jar jenkins-cli.jar [-s JENKINS_URL] -i path/to/Key command
-i KEY :
SSH private key file used for authentication (for use with -ssh or -remoting)