I'm stuck with this problem and I have no idea to solve it.
I have written a Shell script which will invoke my job using Jenkins CLI by passing my private key.Jenkins version is 2.121.1
java -jar jenkins-cli.jar -s http://localhost:8080 -i ~/.ssh/id_rsa build RTT/RTT-CI-Tools/RTT-CI-Tools-Distribute -s -p SLAVE_REGEX=testserver
Getting Error message as :
ERROR: anonymous is missing the Overall/Read permission
The same script works in another Jenkins (2.7.4). How to fix this issue.
You can also use auth param but you should to type your password in console
java -jar jenkins-cli.jar -s http://localhost:8080/ -auth myLoggin:myPassword list-jobs
Please check for below points
1) USER exist on jenkins server as same on linux machine.
2) SSH Public key shared on Jenkins server is correct.(manage jenkins --> manage user --> click on ${USER} --> click on configure --> then check ssh public key is correct).
3) CMD i used(working) --> java -jar jenkins-cli.jar -ssh -user ${USER} -i ~/.ssh/id_rsa -s http://localhost:8080/jenkins/ build ${JOB_NAME}
please check if you are executing cmd from same user.
4) SSH port should be enable on Jenkins (go to manage Jenkins--> configure Global security --> SSH Server... set SSHD Port Fixed eg 38844)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With