Open files as root (the easy way)
by Justin Garrison • 2008/12/06 • How-to, Linux, Ubuntu • 1 Comment
I ran across a couple of tips in Linux to open a file as root without having to use a terminal. The first is a shortcut on your desktop. To make this one just right click on your desktop and then select “Create Launcher…”. When the dialog box pops up you can put in whatever you want for “Name” and “Comment” but for “Command” just put in the following command.
gksudo “gnome-open %u”
Now to open a file as root all you have to do is open the file location and drag the file to that shortcut. The system will probably ask you for your root password and then open the file as root.
A easier way is to browse to ~/.gnome2/nautilus-scripts/ and create a new file called “Open as root”. Edit the file and put
#!/bin/sh
gksudo “gnome-open $NAUTILUS_SCRIPT_SELECTED_URIS”
inside the file. Right click on the file and go to properties -> permissons then check the box that says “Allow executing file as a program”. Now all you have to do is right click on a file you want to open as root, go to scripts and click “Open as root”.
I just wanted to pass these along cause I thought they were very helpful.
I really hoped this would work but as you probably know by now it doesn’t work in Ubuntu 9.04. From what I understand, the ability to launch the “Root Terminal” apparently has been disabled. Do you have another way to make this work as you describe?