To be more specific there are two things to do here. You can "Run" a program or "Install" it.
Running
Running a program only requires that the executable file has the "execute" permission enabled. Programs run like this, from a normal User, have access to everything the User has read/write access to, which is usually directories like /home
, /tmp
, and /media/NAMEOFDRIVE
.
So basically you can run self contained portable programs, scripts, and even build programs using make
as long as they don't need to touch any directory owned by Root.
Installing
Installing a program involves copying it's core components to restricted parts of the OS in order to streamline it's execution and integrate it with other systems and programs. This requires Root permission because it involves writing to directories owned by Root. The reason Root exists is to prevent any rouge programs or scripts from doing critical damage to the OS without getting strict Permission from the User or Administrator.
Generally almost every directory in the "root"(/
) of the filesystem is owned and writable only by Root. The exceptions are /home
(where user profiles and data are stored), /tmp
(where temporary files are written to in order to be deleted when no longer needed or upon reboot), and usually any folder under /media
(but not itself) as this is where things like your USB drives and DVDs are mounted.
Summary
Basically, as long as a program or script has no need to write to a directory owned by Root then it shouldn't be run as Root. A Safety feature in Ubuntu(and Linux in General) is to always prompt the user when a program wants to access an area controlled by Root, which means everytime you run something like APT you will be prompted for your password. The only exceptions to this are programs designed to automatically start at boot, but these programs had to first get Root permission from the User before being able to set that up in the first place.
Also Ubuntu(and some other Distros) take things a step further with the use of the sudo
and gksu
tools. Instead of the original practice of giving a program Root access via su
and that program then having free use of Root until closed, sudo
and gksu
only give Root access for a single command, further limiting the possibility of the User accidentally giving the wrong program free rein of Root.