1

When using natilus as root, open in terminal used to work as using with any user. However, when I press open in terminal when using nautilus as root now, it does nothing.

How to solve it?

The error:

GLib-GObject-CRITICAL **: g_object_set_data: assertion 'G_IS_OBJECT (object)' failed
Vitor Abella
  • 8,055
  • Do NOT use sudo with graphical aplications, especially Nautilus or any other file manager. It can break the userspace permissions quite easily. If you need to do then use sudo -H nautilus instead. –  Oct 04 '16 at 23:33
  • @CelticWarrior I have to constantly make changes on /opt folder. Can I do it using -H? – Vitor Abella Oct 05 '16 at 05:16
  • Yes, you can and should even if it doesn't mess with permissions on system, root owned, folders. The problem is when you write something (as root) to the regular user(s) folders. –  Oct 05 '16 at 09:11

2 Answers2

2

Putting aside any possible damage you've done via sudo nautilus command you could just install & use the nautilus extension nautilus-admin, requires restarting nautilus after install

sudo apt-get install nautilus-admin

It provides

* Open as Administrator: opens a folder in a new Nautilus window running with administrator (root) privileges. * Edit as Administrator: opens a file in a Gedit window running with administrator (root) privileges.

Does so thru a policykit policy.

doug
  • 17,322
  • It does not really answer my question, but it is a good solution. – Vitor Abella Oct 05 '16 at 16:46
  • As far as an answer - While sudo nautilus > open in terminal should open a root terminal @ dir. clicked on it's such poor behavior that figuring out why it 'broke' for you is pointless. Maybe from repeated indiscriminate use of sudo in instances it shouldn't be used? If I were you I'd check recursively for root owned files in your $HOME folder & address. ls -lA -R |grep root – doug Oct 05 '16 at 22:03
  • I now that I created many root owned files, but I also know how to revert it. – Vitor Abella Oct 05 '16 at 23:01
0

I know this thread is more than 8 years old at this point but I was looking for a way to access Nautilus on Ubuntu 24.04.2 LTS with root access yesterday and found a clever way using the following simple command in terminal:

nautilus admin:/

This launches nautilus with the prompt to log in using your password (sudo) and gives root access to nautilus.

Shout out to Raymond KIMATHI at codegeek for the solution I found. Full link to his page: Open nautilus as root – Ubuntu 24.04

He also shows the code needed to add a desktop shortcut in his article however does not elaborate on how to do that.