This tutorial is aimed at all regular users of Ubuntu, Kubuntu and Xubuntu who commonly log in to a non-root account and perform administrative tasks via the “Terminal” (command prompt). Read below to find out how you can perform administrative tasks from a “Terminal” (command prompt) running on a regular account.
The first thing I must make you aware of before you proceed with this tutorial is that you must know the password of an administrative user on the computer you are logging into as a regular user in order for this method to work.
Okay, now we may proceed with the tutorial. The first step is of course to open the “Terminal”, which can be done by using the “Alt + F2” key combination as highlighted below:
Press and hold the “Alt” key and then press the “F2” key, now release both keys
Once you have performed the key combination as highlighted above, you will be presented with a small rectangular window at the top centre of your screen. This small window is the command launcher. In this window you will have a small text box, of which you must enter the text highlighted below into and then hit the “Enter” key:
Once you have entered the text above into the text box and hit the “Enter” key, your “Terminal” (command prompt) will appear.
Now that your “Terminal” is open you can perform your administrative tasks. But first you must decide which administrative task you wish to commit. In this example I will be moving a text file from my personal documents to the root of my HDD, which will require administrative privileges by default. This can be done by using the command you would normally use to move a file from your documents to the root of your HDD, although you will add the command “sudo” at the beginning like so:
sudo mv /home/dillon/Desktop/Documents/thisismyfile.txt /
By entering the command above into your “Terminal” window and then hitting the “Enter” key, you will be asked for the administrator password. You must type the password and then hit the “Enter” key, please note: the password will be invisible as you are typing it, for security reasons.
Now that you have entered the command with the “sudo” at the start and then entered your password, the “sudo” command will search a special file on your HDD in order to verify whether or not the particular user you entered the password for as well as your current user login is authorized to run the command of which you have entered. This file is the “sudoers” file, which is located at the directory highlighted below:
You will notice that after using the “sudo” command, you will be able to run select applications as administrator for a certain amount of time. This is due to the “sudo” command, which will generate a special file that will allow you to use select commands for a set period of time. This file is, in a way a “ticket”, which allows you to enter the administrative functions of select features as often as you want until your “ticket” expires.
You may insert the “sudo” before and command you would like to run that requires administrative privileges wherever you see fit. The “sudo” command will work on any command that requires an administrator to run it, so next time you are stuck without an administrative login don’t fret because help is one word away.
Note: This tutorial will work on the Ubuntu, Kubuntu and Xubuntu platform.
Congratulations! You have just used “sudo” to emulate admin on your system. Enjoy your newfound Linux administration knowledge.