3

I am wondering if there is a safe and easy way to allow ImageJ to update itself by allowing it to replace its ij.jar file with a new one in /usr/share/java? Right now, an error message says "No Write Access: /usr/share/java/ij.jar"

Thanks!

1 Answer 1

1

You have two options:

  • The quicker option: (not recommended) You can run your program as root using sudo (or gksudo, if it is a GUI application). This grants the program the right to modify whatever file it desires, but may also allow it to edit unintended files. This might be a security risk, especially if it contains a bug that might damage your system.
  • The safer option: You modify the access privileges of the single file you want to have updated. That way, your program may run under your normal user account and can not cause more damage than usual. You just have to execute two simple terminal commands:

    First, allow all users to modify the file:

    sudo chmod o+w /usr/share/java/ij.jar
    

    Then you start your program and let it do the update. Close it again afterwards. Now remove the write permission for all users on the file again:

    sudo chmod o-w /usr/share/java/ij.jar
    

    That already was the whole procedure.

3
  • Thank you very much for your answer @ByteCommander! I have played around and found that update also works if I change the ownership of the file by "sudo chown" to me. My next question is: how bad would it be to keep the file ownership to me. Thanks for your time!! May 31, 2015 at 15:00
  • That depends on what your program is going to do... Usually I would say to keep the intended ownerships and permissions is the best way. If you are the owner of this file, you and all applications you start have the right to modify the file. Therefore it is better for security to have the files owned by root. If I was you, I would change it back by sudo chown root:root /usr/share/java/ij.jar. But it might also be possible that you won't notice any disadvantages. You will only know afterwards...
    – Byte Commander
    May 31, 2015 at 16:26
  • Thanks for a word of wisdom! I put the ownership back to root. It is always easier to say something retrospectively (and point finger at someone))). May 31, 2015 at 21:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .