1

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)

1 Answer 1

1

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
1
  • thx, works great :)
    – greenit
    Apr 24, 2012 at 9:27

You must log in to answer this question.

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