Jenkins sudo: no tty present and no askpass program specified with NOPASSWD

后端 未结 3 1263
不思量自难忘°
不思量自难忘° 2021-02-04 00:47

I spend several days setting up the file /etc/sudoers to be able to give permissions to root to the user jenkins. I have Jenkins installed on my server

3条回答
  •  滥情空心
    2021-02-04 01:25

    This is quite possible that you are adding a wrong user to the sudoers file. This happened to me as well and the solution to add an entry in sudoers file wasn't working for me. You will need to know the actual user that your jenkins is using to execute commands. For this purpose you can add a build step (Execute shell) within your jenkins with the following command:

    whoami
    

    Then try running the jenkins job again and in the console output, you will see the user that jenkins is using to execute commands. You will then need to add this user to your sudoers file. For example if the user was 'tomcat', you will add the following line to the end of your sudoers file:

    tomcat ALL=(ALL) NOPASSWD: ALL
    

    Ref: http://techrofile.com/jenkins-sudo-no-tty-present-and-no-askpass-program-specified-with-nopasswd/

提交回复
热议问题