Use GVfs admin backend to open Nautilus file browser or Gedit text editor with root permission? It’s not working in Ubuntu 21.04.
When you run
nautilus admin:// or
gedit admin:// to open folder or document with root, it won’t work and output an error:
GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Unix process subject does not have uid set
The error also occurs when using nautilus-admin extension to enable ‘open as root’ context menu.
Method 1: Install old GVfs from Ubuntu 20.10 repository:
You can download & install the gvfs .deb packages for the previous Ubuntu 20.10. And here are the links for 64-bit system:
Grab the 6 packages, then open terminal (Ctrl+Alt+T) and run command to install all of them:
sudo apt install ./Downloads/gvfs*.deb
Method 2: repack GVfs to revert the commit:
If you don’t want to downgrade gvfs, just rebuild it without the commit. To make things easy, I’ve uploaded into this PPA.
1. Open terminal either from system app launcher or by pressing Ctrl+Alt+T on keyboard. When it opens, run command to add the PPA:
sudo add-apt-repository ppa:ubuntuhandbook1/gvfs
2. Then install the patched version of gvfs via command:
sudo apt install gvfs=1.47.91-2ubuntu1
3. Finally remove the PPA via command:
sudo add-apt-repository --remove ppa:ubuntuhandbook1/gvfs
How to Restore GVfs to stock version:
If you change mind, and want to revert it back, simply run command in terminal:
sudo apt install gvfs=1.47.91-1ubuntu1