Make it executable, either by chmod or Right Click > Properties > Permissions and you should be set. When you right click on a file or empty space in a folder, you can select Scripts > Open as root and it should ask for your password and then open the file or the folder respectively.Code:#!/bin/sh ### openas-root: ### nautilus script for opening the selected files as superuser (uid=0), ### utilizing the appropriate applications. if [ -n "$1" ]; then for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do gksu "gnome-open $uri" & done else gksu "nautilus --no-desktop $NAUTILUS_SCRIPT_CURRENT_URI" fi
As I was trying to create a send-to menu item to send files to gedit, I found your code very useful.
Here's how I modified it:
saved it in ~/.gnome2/nautilus-scripts, as executable.Code:#!/bin/sh gnome-text-editor $NAUTILUS_SCRIPT_SELECTED_URIS
After this, I get a nifty right-click menu titled "Scripts" in Nautilus where I can activate the script after right clicking a file in nautilus. This is very handy when trying to open files that don't open with a text editor by default.
If I run the terminal command in the first post I get multiple error messages:
"(gksudo:5330): Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap",
Nothing happens after that...
I'm too much of a newbie on ubuntu 11.1 to know wht this means and how to fix it. Perhaps someone could help?
For 11.10/12.04 if you want the same deal for a Desktop DnD launcher you could try this
Paste this in, save, close geditCode:gedit ~/Desktop/openit.desktop
finish withCode:#!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Type=Application Terminal=false Exec=gksudo "xdg-open %u" Name=Open as Root Icon=gnome-panel-launcher
Icon= can be generally be whatever you wish, usually best to full path if not a standardCode:chmod u+x ~/Desktop/openit.desktop
Name= can be as desired
For a unity launcher DnD then you'd need to add an appropiate MimeType= line to the .desktop
Status: CELEBRATING 2016!!! (Offline )