Programs, such as Nautilus or gedit, allow you to browse or view all the files on your system, but they only allow you to change or create new files in your home directory (e.g., /home/lori) and its subfolders.
We’ve previously showed you how to access an advanced file manager if you’re using Linux Mint 12. If you’re using Ubuntu 11.10, it’s easy to set up a shortcut that allows you to open any program as root or another user.
To be able to create a shortcut in Ubuntu 11.10, you must install some packages. See our article about creating shortcuts in Ubuntu 11.04 and 11.10 for instructions.
NOTE: When we tell you to type or enter text into an edit box or at the command prompt, and the text is surrounded by quotes, DO NOT type the quotes, unless otherwise specified.
Once you have installed the required packages, press Ctrl + Alt + T to open a Terminal window. Type the following command at the prompt and press Enter.
gnome-desktop-item-edit –create-new ~/Desktop
NOTE: You can also press Alt + F2 and enter the command in the edit box that displays.
The Create Launcher dialog box displays. Enter a name, such as Open As, in the Name edit box. Type the following text in the Command edit box:
/usr/bin/gksu
You can enter a description for the shortcut in the Comment edit box, but it is not required. Click OK to create the shortcut.
You are returned to the prompt in the Terminal window. To close the window, type “exit” at the prompt and press Enter.
The new Open As shortcut displays on the desktop. Double-click on it to invoke it.
The Run program dialog box displays. If you want to run Nautilus as root, enter “nautilus” in the Run edit box, make sure root is selected in the As user drop-down list, and click OK.
Enter your password on the dialog box that displays and click OK.
The following error displays because Nautilus uses a directory in the .config directory in the home directory of the current user, which, in this case, is root. Therefore, we need to create a “nautilus” directory in the /root/.config directory. To do this, we must open a Terminal window as root. We can use our new shortcut to do that.
When the Run program dialog box displays, enter “gnome-terminal” in the Run edit box and click OK.
A Terminal window opens with a pound sign (#) as the prompt. This indicates you are now root. Type the following command at the prompt and press Enter to change to the “.config” directory in the “root” directory.
cd /root/.config
In the .config directory, we need to create a “nautilus” directory. To do so, type the following command at the prompt and press Enter.
mkdir nautilus
If you type “ls” at the prompt and press Enter, you’ll see the new nautilus directory listed. To close the Terminal window, type “exit” at the prompt and press Enter.
Now, when you invoke the Open As shortcut and enter “nautilus,” Nautilus opens with root permissions.
You can add the shortcut to the Unity launcher by dragging and dropping it onto the launcher.
The icon is added near the bottom of the launcher.
IMPORTANT NOTE: Be very careful when changing or deleting files outside of your home directory. If you rename or delete a critical file, you can ruin your system and make it unusable.
You can also run Firefox as root by entering “firefox” on the Run program dialog box. If you want to open the home folder as root, enter “nautilus /home” on the Run program dialog box. To open the command console, enter “gnome-terminal” on the Run program dialog box. You can run most programs as root in this manner, as long as you know the command to run the program. See our article about finding files and folders in Linux using the command line for information about the which and whereis commands that can help you find executable files.
No comments:
Post a Comment