reference: https://stackoverflow.com/questions/29926773/run-shell-command-in-jenkins-as-root-user
-
sudo vi /etc/default/jenkins
-
$JENKINS_USER="root"
-
sudo chown -R root:root /var/lib/jenkins
sudo chown -R root:root /var/cache/jenkins
sudo chown -R root:root /var/log/jenkins
-
service jenkins restart ps -ef | grep jenkins