Just wondering why there is no option in Ubuntu's desktop environment to open a program, for example Nautilus, as root. I know that I can accomplish this in the terminal, but wouldn't it benefit the Ubuntu's usability to allow this to be done by simply right clicking on a program?
2 Answers
Because that is not the intended usage of Nautilus manager. It is intended to manage user related files. Like your documents.
Because we do not use a "root" account and editing files with your admin account (aka. "sudo") will change the permissions and then break stuff. Famous files are .xsession-errors
and .XAuthority
in your home. If those change into anything else than what they currently are (rw- --- ---
and owned by $USER:$USER
) you can no longer log into the desktop.
Editing files you need to edit as a admin you should really do from command line. The occasional gksudo nautilus
or even gksudo gedit
might be useful but should not become common. It will at some point break stuff and that almost always happens when you least expect it and at the worst time.

- 107,489

- 299,756
No.
Running anything as root
is dangerous for your entire system and therefore something that should only be done by experienced administrators. If that was available as simple right-click option everywhere, you can imagine how many applications would be run as root without necessity. That would be a security problem (malware or attacked/infected webbrowsers with root privileges sounds not like a good idea) and let many users accidentally destroy their installation (login-loops are probably the most common consequence of bad sudo
usage).
Therefore the small extra effort to run an application as root protects careless users from too quickly doing something they might regret without having/taking time to think about it again.
Other than that, most tools that are needed by "simple computer owners" to administrate their machine like the System Settings or GParted automatically ask for the (gk
)sudo
password when needed.
But the terminal is not required to run an application (only if it really needs it!) as root. You may just use the Unity HUD to execute a single command. Open it by pressing Alt+F2, then enter gksudo APPLICATION-NAME
and hit Enter/Return.
You could even add "Run as root..." to the right-click menu of a launcher if you want. But that requires modifying its .desktop
file and is something I'm not going to describe here.

- 107,489
-
Unfortunately I can't do that, because the program, bitcoin, is not from the ubuntu software center. – draoi Nov 16 '15 at 23:07
-
You can't do what? You can do everything if you know how to approach it! How do you usually start your bitcoin application and how do you want to start it? I guess we'll find a way to achieve it. Just tell me what you need. :-) – Byte Commander Nov 17 '15 at 06:44
-
I've got a pretty good solution now. I have a bash file that opens the application for me, with these two lines of code: #!/bin/bash sudo ~/Documents/bitcoin-0.11.2/bin/bitcoin-qt – draoi Nov 18 '15 at 09:23
-
-
-
You don't really need a bash script to run an application. By the way, it's a GUI application, so we should not use
sudo
. Let me write a quick .desktop file for you that you can put onto your launcher. Or do you already have a .desktop file for it (does it appear in the launcher or the dash)? If so, please post its contents and then we modify it accordingly. – Byte Commander Nov 18 '15 at 09:36
sudo chmod 775 bitcoin-qt
and that is it. – Rinzwind Nov 17 '15 at 07:43