|
HOWTO: Launching program in GNOME menu with root privileges
There are at least a couple ways to do this. The first is a simple and non-permanent method of running a user program with root privileges. The second makes the privileges permanent and is used for all the standard programs that need to be run as root (such as all those in /sbin, /usr/sbin, etc.).
1) If you have set up your sudoers file and have a working sudo command (recommended), then simple issuing a `sudo <programname>` from a terminal will allow you to run the program with root privileges. Since you're looking for a file manager, you would use `sudo nautilus`, enter the root password and nautilus will opon up in /root with full access to all files/folders.
2) This method uses the program /usr/bin/consolehelper which is the little pop-up box you get when you you run any of the programs in the menu requiring root permissions (such as System Tools -> System Logs). It allows you to simply enter your root password into the box and the program launches as root. It is simply a GUI wrapper to the program /usr/bin/userhelper which is the program behind the scenes doing all the real work.
As an example, here's how you would add an entry for a "super-user" nautilus, the graphical shell for GNOME to require root's password and thus gain full access privileges:
[code:1]
# first copy /usr/bin/nautilus to /usr/sbin/nautilus
$sudo cp /usr/bin/nautilus /usr/sbin/nautilus
# now move /usr/bin/nautilus to an alternative location such as $HOME/bin
$mv /usr/bin/nautilus $HOME/bin
##NOTE: If you move it to $HOME/bin you can still run it with $`nautilus` if you add this location to your PATH. For example my .bashrc file contains:
"PATH=$HOME/bin:$PATH:/usr/local/j2re1.4.2/bin" (w/o quotes). [Adding $HOME/bin to the front of your PATH will be needed otherwise /usr/bin will be searched first and you'll just get a command not found error]##
# Now create a symlink from nautilus to consolehelper
$cd /usr/bin
$sudo ln -s consolehelper nautilus
# The PAM config files must be created for nautilus
$sudo gedit /etc/pam.d/nautilus
# Enter the following and save
------------CUT HERE-------------------------------------------
#%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
# Enter the following and save
------------CUT HERE-------------------------------------------
USER=root
PROGRAM=/usr/sbin/nautilus
SESSION=true
-------------------------------------------------------------------
[/code:1]
Now, running nautilus from the command line or from the GNOME menu -> Home Folder will prompt for your root password.
One final thing you may wish to do is re-add a menu entry for a regular nautilus program. To do this you:
[code:1]
# Edit the menu entry for "Home Folder" to now specify it as the superuser # version
$sudo gedit /usr/share/applications/gnome-nautilus.desktop
-> Change the "Name" item to something like "Home Folder (Super User)" and save.
# Now create a new menu entry for the regular user version
$sudo gedit /usr/share/applications/gnome-nautilus-orig.desktop
# Enter the following and save
------------------CUT HERE------------------------------------------------------
[Desktop Entry]
Encoding=UTF-8
Name=Home Folder
Comment=View your home folder in the Nautilus file manager
Exec=/home/$USER/bin/nautilus
Icon=gnome-home.png
Terminal=false
Type=Application
Categories=Application;Core;X-Red-Hat-Base;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=nautilus
X-GNOME-Bugzilla-Component=general
X-Gnome-Bugzilla-OtherBinaries=nautilus-adapter;nautilus-content-loser;nautilus-sidebar-loser;nautilus-text-view;nautilus-throbber;
X-Desktop-File-Install-Version=0.3
OnlyShowIn=GNOME;
--------------------------------------------------------------------------------------
[/code:1]
## NOTE: In "Exec", exchange $USER for your username
Now if everything went fine (and I hope it did!), you should now be able to select Menu-> Home Folder and receive the regular non-privileged nautilus window or Menu -> Home Folder (Super User) and be prompted for root's password to reach a nautilus window with full access permissions.
Well that's (finally) it. Feel free to add any corrections.
by mhelios (MH, 2004)
|