Mar 25
Execute a command as root or someone else
On ubuntu, for example, executing commands is normally under a user other than root. In fact, root is deactivated altogether to make the system more secure even for novice users.
However, on certaincircumstances you need to do things as root. This is where su (switch user) comes into play, or sudo (switch user and do). Executing things like
sudo ls
will run the command as if you were root, giving access to higher privileges without really becoming this more privileged user.
Another way to do this is by using the gksu command, the graphical alternative to su, which gives you point-and-click functionality. Gksu is used, for example, when you need to upgrade ubuntu from certain versions
An example command would be gksudo "update-manager -c -d".
In different environments it might be needed to execute a command as someone else (not the superuser root), like user foo. To do this you can use the gksu (gk switch user) command or on the console a simple su and then your commands.