Using sudo and root privileges in Ubuntu

Root and Sudo Admin Privileges in Ubuntu

Ubuntu

Well, this is the first confusion I had after installing Linux based Ubuntu. During the installation it created a user account and asked password for it but didn’t asked to creat a root account and set password for it. When I clicked on some applications where a super user privileges were needed I was asked to enter the root password. Since I set up only one password during the installation, so I assumed that it would work for root account as well, and it did.

Ubuntu by default restricts direct root account login to make Ubuntu more secure. Default user can take all the actions as super user (user with root or super user privileges) by providing password whenever needed. You do not need a password to launch and use applications but you do need password when playing around with System Tools, Administration and some tasks in Preferences. Ubuntu documentation clearly states that it is highly recommended not to allow root to log in graphically. But isn’t open source software means freedom? Yes it does and if you enjoy freedom by taking risks then you can enable root log in via graphical interface. In Gnome, Open System –> Administration –> Login Screen Setup. Click on the security tab and check Allow root log in. I am doing great with out enabling root login and I find it quite fun to have full control without switching between sessions.

Default user can run all the Administrative tasks using terminal as well as Graphical interface for different utilities. Below are a few examples of using sudo in various ways:

To copy paste a file in a directory where you can not normally paste anything without sudo privileges. For example, when adding fonts into share directory:

sudo cp /home/username/Desktop/fontname.ttf /usr/share/fonts

To launch any application with super user privileges do this:

gksudo gedit

The above given command opens Gedit, default text editor in Ubuntu. You can replace gedit with any other application you want to launch. You can launch your file browser and edit files which you can not normaly edit without super user privileges:

gksudo nautilus

Your password is stored by default for fifteen minutes after this time you will be asked to re-enter super user/ root password.

Ubuntu Wiki has detailed information about using the sudo and root account.

Related Posts