Jenkins runs with 'jenkins` user. Just cause it works in terminal with your logged in user, doesn't mean that it's configured to work with 'jenkins' user.
From your terminal, do:sudo su jenkinsand then try running sudo from jenkins's user
sudo su jenkins
sudo