the problem
I installed IntelliJ IDEA on my system (to /opt/jetbrains
), and want it to be able to modify its files (do self-updating) without enabling any other process to modify them.
the configuration
I've come up that I will need a system user, to whom the /opt/jetbrains
directory will belong to, and I will run IDEA as that user:
# Set up things
sudo mkdir /opt/jetbrains
sudo adduser --system --home /opt/jetbrains jetbrains
sudo chown jetbrains /opt/jetbrains
# Install IDEA
wget https://download.jetbrains.com/idea/ideaIU-2017.1.2.tar.gz -O idea.tar.gz
sudo -u jetbrains tar -xzf idea.tar.gz -C /opt/jetbrains/
rm idea.tar.gz
# Configure idea.desktop
# set the 'Exec' line, to run as user jetbrains
what i tried
I have read Run a shell script as another user that has no password
I tried the following, but I got an error, as well as a password prompt.
sudo su -c "/opt/jetbrains/idea-ultimate/bin/idea.sh" -s /bin/sh jetbrains
sudo -u jetbrains /opt/jetbrains/idea-ultimate/bin/idea.sh
Both output:
No protocol specified
Start Failed: Failed to initialize graphics environment
java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
at ...
I also tried gksu -w -u jetbrains gksu /opt/jetbrains/idea-ultimate/bin/idea.sh
, but that prompted me a password - of user jetbrains
, who obviously has no password.
/opt
. However, running it with that user will give you problems when you try to modify projects into your home directory.