0

UPDATE


I would like to know which is the recommend way of running GUI applications as root, mainly because what I'm trying isn't running smoothly. I get some annoying warnings that makes me think whether I'm doing something wrong or not.

I'm using gksudo and sudo -i, which I understand, are doing the same thing. Please let me know if there is some slight differences between them.

Regarding the problems I'm experiencing, I would like to start with nautilus (run as root). I can't edit the preferences file maybe because the program couldn't create its own configuration files. A warning says that the folder /root/.config/nautilus must be created. When you start an application for the first time, the program is responsible for creating the configuration files it will potentially need. So, when you are running as root, it should happen the same, shouldn't it?

Furthermore, in the shell appears some strange warnings while running this application, such as the followings:

(nautilus:3406): 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: The "shared network" returned error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error It doesn't exist the file or the folder Please ask your system administrator to enable user sharing.

Other applications like gedit or firefox complained in this way:

(gedit:3444): 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:3444): GLib-GIO-WARNING **: Failed to parse translated string ''Monospace 12'' for key 'editor-font' in schema 'org.gnome.gedit.preferences.editor': 0:expected value

(gedit:3444): GLib-GIO-WARNING **: Using untranslated default instead.

(firefox:2719): Gtk-CRITICAL **: IA__gtk_clipboard_set_with_data: assertion 'targets != NULL

I want to make a clean install of the system soon, but before that, I would like to understand how it works in case I need this stuff in the future for specific things. Though I know it's safer to use the straight sudo in the command line instead.

Why this is happening? Thanks in advance

2

The issue with using a straight sudo nautilus is that it will sometimes try to use configuration files from your user's home directory. This can cause root (superpriviledged user) to change permissions on files within your home directory. This is not usually harmful long-term; it can cause annoying problems like refusing to login to your desktop, but you can usually restore previous configurations by typing:

sudo chown -R user:user ~/

So what gksudo and sudo -i do is simply to tell the program to run with either copies of .Xauthority and other configuration files or with ones that actually belong to root. I personally prefer sudo -i so I don't have to type in my password every time, but it's totally preference. The two commands are doing the same thing.

| improve this answer | |
  • Forgot to mention - the reason you're having problems with configuration probably is because it's using root configuration files instead of your user configs. They may not exist, hence the problems. – anonymous2 Apr 6 '16 at 17:13
  • And why this happens? As I understand, when you start an application for the first time, the program is responsible for creating the configuration files it will potentially need. So, when you are running as root, it should happen the same, no? Thanks for your help! @anonymous2 – Alejandro_Ubuntu Apr 6 '16 at 17:31
  • Good question. Do you get errors just on nautilus or with all applications? It's relatively normal for some applications to generate warnings, but if you're getting errors with all or most applications, it could be revealing to know what they are. Also, if you run top or some other commandline application as sudo, do you get errors? – anonymous2 Apr 7 '16 at 12:41
  • I've installed Ubuntu on my computer this week, hence I don't think something has got corrupted. The command 'sudo' works fine for me, my problems start just when I want to run GUI applications. It seems that other programs does not work properly. Continuing with nautilus, I can't edit the preferences file maybe because the program couldn't create its own configuration files. A warning says that the folder '/root/.config/nautilus' must be created. Moreover... @anonymous2 – Alejandro_Ubuntu Apr 7 '16 at 23:13
  • (nautilus:2176): 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: La «red compartida» devolvió el error 255: net usershare: cannot open usershare directory /var/lib/samba/usershares. Error The file or folder doesn't exists Please ask your system administrator to enable user sharing. – Alejandro_Ubuntu Apr 7 '16 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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