Fixed ‘sudo: no tty present and no askpass program specified’?

I was trying to run some commands on agent machines using Jenkins  and those commands needed   “sudo” access as Jenkins was not running under root user. Those commands resulted in following error

After googling i found that its related to sudo previleges.

How i Fixed “no tty present and no askpass program specified’ error ?

Granting the user to run the commands without prompting for password resolved the problem.

Login to machine and edit the /etc/sudoers file using any of the following

or

Add the following line at the END OF THE FILE

You can replace the user “jenkins” with the username which give this error

Please make sure you are adding these lines at the end of the file. Else it might not work, as there can be other configuration entries conflicting with the above entry. Placing this line at the end of the file will make sure the new line will get the priority.

After adding this line i was able to run sudo command successfully.

Leave a Reply

Your email address will not be published. Required fields are marked *