1

I have an rpm package which runs with sudo rights, that application wants to fetch the proxy configuration of the machine (should fetch the proxy configuration of users level as well), As we know we can set the proxy configuration multiple ways. Currently, I am talking about when you configure the proxy through System Settings > Network Settings > Proxy

I use gsettings list-recursively org.gnome.system.proxy cmd, and it is returning the values, but those are specific to the current user (Currently I am getting the current root user proxy configuration because I installed the application with sudo). I want to fetch the proxy configuration of each user including the root user from the root user access.

It would be great if I get any common query that executes against system settings ->network ->network proxy and fetch the proxy configuration for the sudo user and the other users. If GSettings doesn't support please suggest any alternative ways.

unknown
  • 113

1 Answers1

1

That is similar to:

The target user's dbus session is needed for this command, so a simple: su username -c "dconf load /" won't suffice. But fortunately, there's a simple way to accomplish this: the dconf load should be prefixed with dbus-launch, i.e.:

sudo su username2 -c "dbus-launch dconf load / < file"

The only problem after this is to kill 2 newly created processes: dbus-daemon & dconf-service, but that's manageable (their parent is the upstart process of the user invoking the sudo command).

From Anatoli's Comment in one of my answers.

Things may changed a bit:

  • Command translated to:

    sudo su username2 -c "dbus-launch gsettings list-recursively org.gnome.system.proxy"
    
  • The newly created processes should be child of the new systemd init process. With same names dbus-daemon & dconf-service. Check using:

    sudo ps -aux | grep ...
    
user.dz
  • 48,105