I am trying to compile some sources using a makefile. In the makefile there is a bunch of commands that need to be ran as sudo
.
When I compile the sources from a terminal all goes fine and the make is paused the first time a sudo
command is ran waiting for password. Once I type in the password, make resumes and completes.
But I would like to be able to compile the sources in NetBeans. So, I started a project and showed netbeans where to find the sources, but when I compile the project it gives the error:
sudo: no tty present and no askpass program specified
The first time it hits a sudo
command.
I have looked up the issue on the internet and all the solutions I found point to one thing: disabling the password for this user. Since the user in question here is root. I do not want to do that.
Is there any other solution?
In Jenkins:
Eg:-
You can use Mask Password Plugin to hide your password
Running shell scripts that have contain sudo commands in them from jenkins might not run as expected. To fix this, follow along
Simple steps:
On ubuntu based systems, run " $ sudo visudo "
this will open /etc/sudoers file.
save the file
Relaunch your jenkins job
you shouldnt see that error message again :)
I was getting this error because I had limited my user to only a single executable 'systemctl' and had misconfigured the visudo file.
Here's what I had:
However, you need to include the full path to the executable, even if it is on your path by default, for example:
This allows my jenkins user to restart services but not have full root access