To run shell commands on Jenkins with sudo previleges we have to edit the
It is not a good practice to modify it directly like for eg
sudo vim /etc/sudoers
Don't do this. If there are any syntax errors in the edit it may cause problems.
The best way to edit
/etc/sudoers file is by using
This will open the
sudoers file. We have to add the following line to the file.
jenkins ALL=(ALL) NOPASSWD: ALL
Now exit the editor by pressing ESC and
:wq and hitting Enter.
Now you are ready to use
sudo in your Jenkins shell.