Can I open a file as root by just using the right click menu
Solution 1:
You need the admin extension
$ apt-cache search nautilus | grep admin
nautilus-admin - Extension for Nautilus to do administrative operations
Install it with sudo apt-get install nautilus-admin
Solution 2:
I tested the solution from here, and it works fine (running 14.04/nautilus).
To not post a link-only answer:
-
install
gksu
sudo apt-get install gksu
Navigate to
~/.local/share/nautilus/scripts
-
Create and open an empty file, name it
open-as-administrator
, paste the script below:#!/bin/bash # # this code will determine exactly the path and the type of object, # then it will decide use gedit or nautilus to open it by ROOT permission # # Determine the path if [ -e -n $1 ]; then obj="$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" else base="`echo $NAUTILUS_SCRIPT_CURRENT_URI | cut -d'/' -f3- | sed 's/%20/ /g'`" obj="$base/${1##*/}" fi # Determine the type and run as ROOT if [ -f "$obj" ]; then gksu gedit "$obj" elif [ -d "$obj" ]; then gksu nautilus "$obj" fi exit 0
Make the script executable
-
Either log out and back in, or run:
nautilus -q
AGAIN: the script is not mine! found it on http://ubuntuhandbook.org