I’d really like a tool to open something as root from Nautilus. It’s irritating to want to edit a file and then have to open a terminal, rather than just directly right click and open as root.
Here is a work-around. First create a new, empty nautilus script:
mkdir -p ~/.gnome2/nautilus-scripts
touch "~/.gnome2/nautilus-scripts/Open As Root"
Then place the following code inside of it:
#!/bin/sh
if -z "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]]
then
NAUTILUS_SCRIPT_SELECTED_FILE_PATHS=${NAUTILUS_SCRIPT_CURRENT_URI/file:\/\//}
fi
for path in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
do
if -d "$path" ]]
then
gnomesu -- nautilus --no-desktop "$path"
else
gnomesu -- gnome-open "file://$path"
fi
# uncomment the next line to process only the first path
#break
done
Now make it executable:
chmod a+x "~/.gnome2/nautilus-scripts/Open As Root"
Restart nautilus and you should now see a “Scripts” submenu below “Open With”, and under the Scripts submenu should be “Open As Root”, which will open folders in a new nautilus window as root, and files in their default applictions as root.