How to run a script as root in Jenkins?

0 votes

Hi Guys,

I have configured Jenkins on the Linux system. I want to run a script as root in Jenkins. How can I do that?

Oct 25 in Jenkins by akhtar
• 32,960 points
145 views

1 answer to this question.

0 votes

Hi@akhtar,

You need to run the script with Sudo. This will run the script with root privileges.

$ sudo /path/to/script

But before you must allow Jenkins to run the script in /etc/sudoers.

jenkins    ALL = NOPASSWD: /path/to/script
answered Oct 25 by MD
• 77,580 points

Related Questions In Jenkins

0 votes
2 answers

how to execute a shell script post build step in Jenkins?

You could use the Post Build Task Plugin ...READ MORE

answered Jul 31, 2019 in Jenkins by Sirajul
• 58,210 points
16,587 views
+3 votes
2 answers

How to trigger a Jenkins pipeline A in another Jenkins pipeline B?

If you are talking about executing another ...READ MORE

answered Jul 31, 2019 in Jenkins by Sirajul
• 58,210 points
32,954 views
+1 vote
4 answers
0 votes
1 answer

I’m facing a login error when I try to run Jenkins on Docker. How do I solve this?

You have to open the /var/log/jenkins/jenkins.log file to ...READ MORE

answered Jul 24, 2018 in Jenkins by Sophie may
• 10,100 points
1,079 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
803 views
+2 votes
1 answer
0 votes
1 answer

how to pass a file to downstream job in jenkins?

Hi@Sourabh, You can do this task by sharing ...READ MORE

answered May 27 in Jenkins by MD
• 77,580 points
432 views
0 votes
1 answer

is there a way how to finish in-progress slave builds if Jenkins master goes offline

Hi@, You can assign your Jenkins Job to ...READ MORE

answered Jun 30 in Jenkins by MD
• 77,580 points
374 views