Run bash script from IntelliJ as root

I have a bash script that needs root privileges. I launched it sudo ./script.sh

.

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

Is it possible that without running the IDE as root, or with tools like gksudo

or gksu

?

+3


source to share


1 answer


It was not completely clear which Bash integration you are using. Probably something like a plugin: BashSupport

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

The runtime configuration window for this plugin does not seem to expose the permission configuration.

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



  • You keep your script as is
  • Create a second one that calls your current one with sudo

sudo ./myscript.sh

enter image description here

+1


source







All Articles