nautilus-gksu

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.

According to Linux Tip: Do more with Nautilus , Ubuntu has such a package.

There are also steps here: :: View topic - Open As Root?](http://linuxgator.org/forums/viewtopic.php?t=986&sid=b57e6efbb5452fcb069e9c119a8ed00c) for adding a script to do the same thing, but we don’t have gksudo (just sudo).

I’d really like to see this happen in openSUSE…

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.

HTH