0

This question already has an answer here:

When running gedit with sudo, editing and saving a file causes the following error to appear (twice). Note that the first time it appears is when the file is edited in any way - even just pressing the space bar. Then it happens again when saving.

(gedit:4063): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

(gedit:4063): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

This did not always occur, but started recently. It seems to be a non-fatal error. Can it be corrected?

I am using 14.04 LTS. I use Unity but supplement it with Docky and Classic Menu Indicator Applet.

When running sudo nautilus, a similar error occurs:

(nautilus:4604): Gtk-WARNING **: Failed to register client: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files
Nautilus-Share-Message: Called "net usershare info" but it failed: 'net usershare' returned error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error No such file or directory
Please ask your system administrator to enable user sharing.

Again, this did not occur until recently, so I believe the problems are related.

marked as duplicate by muru, A.B., Eric Carvalho, user364819, Pilot6 Sep 11 '15 at 7:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Use gksudo nautilus or sudo -H nautilus or sudo -i nautilus instead. – Liso Sep 10 '15 at 2:09
0

Never run graphical applications with sudo. If you must, use gksudo instead.

sudo runs a command with superuser privileges, but does not change the home directory. Graphical applications usually assume that the current home directory belongs to the current user, and that they are allowed to store (and refer back to) configuration files there. However, if they do this under sudo, you'll have the root user trying to store files in your home directory, ending up with incorrect file permissions which will cause later problems.

It's possible your problems will go away immediately if you use gksudo instead, though you should check for root-owned files in your home directory anyway as they may cause further problems.

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