Cannot login as administrator in Nautilus

Hello, I’m trying to use nautilus as an administrator but got this error in the terminal using

sudo nautilus

No protocol specified
Unable to init server: Could not connect: Connection refused

I am a administrator user and never had this issue with other distros. New to Fedora. Could it be that when I loaded Fedora I used an enterprise login by mistake?

The reason is that Fedora by default signs you in to GNOME on Wayland, which forbids running GUIs as root for security reasons. The preferred alternative is to run whatever needs root in a separate daemon and have the GUI communicate with that via an authentication framework known as polkit.

In this case, GNOME provides gvfs-admin, a virtual filesystem for securely accessing directory structures as administrator. If you prefix any path in Nautilus with admin://, it will communicate with gvfs-admin to access that location. For example, to access /etc as root in Nautilus, you can run nautilus admin:///etc. This also works with gedit; you can do stuff like gedit admin:///etc/resolv.conf to edit the given file as root.

1 Like

Thanks for the response. Found a Python extension for the Nautilus file manager that adds some administrative access to the files by right clicking. Not clear on how to install it but it’s called Nautilus -Admin. Manjaro has this pre-installed. Need to research more. I’m all thumbs when it comes to using the terminal.

Based on looking at the source, that actually just opens the file with admin:// like I mentioned before.

I believe there is some work in Wayland to support running apps as root. The argument was that if it worked in X then why it shouldn’t work in Wayland.

Also I remember I used some command that allowed me to run apps as root on Wayland.

The work there was to allow apps running under XWayland to run as root.

Wayland itself will likely never allow apps running natively as root, which imho is the correct thing to do. Applications that need root permissions should use the correct methods to receive elevated privileges.

I think Dolphin (the KDE FM) even refuses to run as root.

1 Like

Makes sense. Thanks for the clarification.