Open files with administrative privileges from the file manager

To enable support for opening files with administrative privileges from the file manager, you need to add a Nautilus script:

Warning: Please note that opening files with administrative privileges constitutes a security risk. Always ensure that you are familiar with the file that you are opening.
  • Open a new file to edit in the relevant directory:
    gedit $HOME/.gnome2/nautilus-scripts/Open\ as\ Administrator

  • Insert the following lines into the new file:
    for uri in $NAUTILUS_SCRIPT_SELECTED_URIS; do gksudo "gnome-open $uri" & done
  • Save the edited file (an example)
  • Make the edited file executable:
    chmod +x $HOME/.gnome2/nautilus-scripts/Open\ as\ Administrator

  • You can now open files as root by right clicking on the file and selecting Scripts->Open as Administrator