jonderry
jonderry

Reputation: 23633

Run intellij application with sudo privileges

I have a scala application that needs to perform sys.process operations with sudo and these operations are failing for me. From my google searching, it appears that I may be able to resolve this by running intellij with sudo. However, when I do this, I'm prompted to import settings and need would need to re-import my project. This seems less than ideal. Is there a way to set up a run configuration in intellij to have sudo privileges or at least run idea.sh with sudo but use my original workspace, so that all changes and configurations are shared between the sudo and non-sudo profiles?

Upvotes: 1

Views: 4124

Answers (1)

matt helliwell
matt helliwell

Reputation: 2678

Presumably this is down to Intellij reading its settings from a directory under the current user directory, eg C:\Users\matt.IntelliJIdea13 on my Windows PC. When you sudo, it will try and read its setting from a different directory.

I would check with directory it is trying to save its config to when you run it with sudo. Then set up a soft link from this directory back to your normal user directory. IntelliJ should then read the same set of files whether or not you are using sudo.

eg ln -s /home/matt/.IntellijIdea13 /home/root/.IntelliJIdea13

I haven't got IntelliJ installed on Linux so can't check this.

Upvotes: 1

Related Questions