Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I wrote a Java program, which should change my /etc/apt/apt.conf.d/01proxy file. I have a server, which is not always running and i don't want to manually change the proxy, so i made a graphical program.

Everything is working, however, only if i change the directory-owner to me instead of root, and i don't like this... Is there a way to grant superuser write-permission to my java-program?

For example that the window asking for the password is popping up, but not when i start the program, only when i click on the button to change the proxy.

the program does the following:

  • look if server is up (working, without su)
  • look if proxy is set to server (working, without su)
  • set proxy to server / normal (working, only with su)
share|improve this question

1 Answer 1

up vote 1 down vote accepted

I don't think you should ever grant superuser access to anything.

I suggest to copy /etc/apt/apt.conf.d/01proxy to a location that is writable by your java program, and then symlink to it from /etc/apt/apt.conf.d/01proxy. Like this:

cp /etc/apt/apt.conf.d/01proxy ~/etc/apt/apt.conf.d/01proxy
sudo ln -sf ~/etc/apt/apt.conf.d/01proxy /etc/apt/apt.conf.d/01proxy
share|improve this answer
    
thx, works great :) –  greenit Apr 24 '12 at 9:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.