I want to be able to quickly open a new window of Pantheon Files with root to do administrative tasks (e.g. edit .desktop files). So when I right-click on a folder icon it would be nice to have an option to "Open folder as root" similar to the already present "Open in Terminal".
It is already there for me in the dock:
However, if you can't see that, use
sudo -i pantheon-files
You want to be able to jump to a
sudo instance of the current folder. It's a little roundabout, but you could right click, open in terminal:
Then run this command:
sudo -i pantheon-files $(pwd)
you could even set up an alias for it.
We need to create a
.contract file in
Run these two commands:
sudo touch /usr/share/contractor/openasroot.contract sudo nano /usr/share/contractor/openasroot.contract
Then paste in the following:
[Contractor Entry] Name=Open folder as root Icon=pantheon-files Description=Open current folder as root privilege MimeType=inode; Exec=gksudo pantheon-files Gettext-Domain=pantheon-files
Just a reminder, be careful when you have root access - bad bad things can happen.
This script works on elementary OS Loki to add "Open folder as root" option via
To use it, first create a contractor entry:
sudo touch /usr/share/contractor/folder-openasroot.contract gksudo scratch-text-editor /usr/share/contractor/folder-openasroot.contract
Then edit it like this:
[Contractor Entry] Name=Open folder as root Icon=pantheon-files Description=Open folder as root MimeType=inode; Exec=pantheon-files-pkexec %U Gettext-Domain=pantheon-files
And then via terminal run this command:
sudo sh -c 'echo "#!/bin/sh pkexec \"/usr/bin/pantheon-files\" \"\$@\"" > /usr/bin/pantheon-files-pkexec'