Thanks to some great input and suggestions from David L. Norris, I have
updated this document to reflect his superior solution. It eliminates
the need to alter /usr/bin/nautilus
and modify your PATH by making a separate filename specifically for a
root-privileged nautilus.
He has also written a handy shell script to automate the process
entirely. It can be found here.
Warning:Take note that running programs with root
privileges can be potentially
dangerous as there is no protection for the user. Take due care and
always understand what you are doing
before messing with important files and remember to back up!
Most of the programs one would use that require root privileges in the GNOME menu tree have already been set up as part of the standard Fedora desktop installation. However, there may be some you add or even ones there that you would benefit from having the ability to run as root. One of these, and the one I will use as my example is nautilus the standard GNOME GUI file manager.
There are at least a couple ways to do this. The first is a simple, command-line method of running a program with root privileges (from a normal user account). The second is a GUI-based approach to the process and is used for all the standard programs that need to be run as root (such as all those in /sbin, /usr/sbin, etc.). It is the focus of this tutorial.$cd /usr/binThis will be the program name we run to grant root priviliges to nautilus. Next, the PAM configuration files must be created so that nautilus can authenticate properly:
$sudo ln -s consolehelper nautilus-super
$sudo gedit /etc/pam.d/nautilus-superEnter the following and save:
#%PAM-1.0
auth sufficient pam_rootok.so
auth sufficient pam_timestamp.so
auth required pam_stack.so service=system-auth
session required pam_permit.so
session optional pam_xauth.so
session optional pam_timestamp.so
account required pam_permit.so
$sudo gedit /etc/security/console.apps/nautilus-superEnter the following and save:
USER=rootNow, running "nautilus-super" from a terminal will prompt for your root password:
PROGRAM=/usr/bin/nautilus
SESSION=true
One final thing you may wish to do is add a menu entry for this superuser nautilus. To do this, copy the menu entry for "Home Folder" to a new file and open it for editing:
$cd /usr/share/applicationsChange the relevant variables in the file to the following and save:
$sudo cp -a gnome-nautilus.desktop gnome-nautilus-super.desktop
$sudo gedit /usr/share/applications/gnome-nautilus-super.desktop
Name=Home Folder (Super User)You should now be able to select GNOME Menu-> System Tools -> Home Folder (Super User) and be prompted for root's password to launch a nautilus window with root access permissions.
Comment=View all files on the system with a Super User Nautilus.
Exec=nautilus-super
Categories=Gnome;Application;System;Utility;X-Red-Hat-Base