Gsettings changes not working on ssh
I am trying to install idle timeout
for Ubuntu 14.04
using gsettings
from ssh.
The commands I am using are similar to the following
dbus-launch gsettings set org.gnome.desktop.session idle-delay 600
dbus-launch gsettings set org.gnome.desktop.screensaver lock-delay 0
dbus-launch gsettings set org.gnome.desktop.screensaver lock-enabled true
dbus-launch gsettings set org.gnome.desktop.screensaver idle-activation-enabled true
timeout
Changes occur after commands with different periods are executed , but those timeout changes are lost after reboot or logoff.
Is it possible for the timeout changes to be persistent across reboot / logoff.
source to share
Basically when you start a new dbus instance with dbus-launch
you are saving the configurations in the wrong place by opening a new dbus. Adding invokation dbus-launch
to the beginning gsettings
removes all error messages, you won't save your changes.
There is an existing dbus process for the target user and via ssh your terminal is not getting the correct environment variables it can handle.
The correct way to edit gsettings via ssh is to first define an DBUS_SESSION_BUS_ADDRESS
existing dbus process and set it as an environment variable. Thus:
PID=$(pgrep gnome-session)
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ)
# And now:
gsettings set org.gnome.desktop.session idle-delay 600
source to share
On Ubuntu 18.04, you have to install not only DBUS_SESSION_BUS_ADDRESS
, but also XDG_RUNTIME_DIR
. You can do it with this command (replace 121
with UID and gdm
username):
su gdm -s /bin/bash -c 'XDG_RUNTIME_DIR=/run/user/121 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/121/bus gsettings get org.gnome.desktop.session idle-delay'
source to share