Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run bash script from IntelliJ as root

I have a bash script which needs root privileges. I run it by sudo ./script.sh.

I would like to create run configuration in IntelliJ IDEA, that runs this script with root privileges. It doesn't matter if it asks for password later.

Is it possible without running IDE as root or using tools like gksudo or gksu?

like image 259
koto Avatar asked Sep 15 '25 17:09

koto


1 Answers

It was not super clear what Bash integration you use. Probably something like the plugin: BashSupport

https://plugins.jetbrains.com/plugin/4230-bashsupport

The runtime configuration window for this plugin seems not to expose permission configuration.

Hence, a simple pragmatic solution could be to actually write two scripts.

  1. You keep your script as it is
  2. Create a second one that calls your current one with sudo

sudo ./myscript.sh

enter image description here

like image 191
dbalakirev Avatar answered Sep 18 '25 08:09

dbalakirev