The Root Account In Ubuntu

0
1

The default user's account

The user account created when installing Ubuntu is not the same as a root or administrator account, but belongs to the same group of users.

There are several options if the user wants to do system maintenance with the default user account:

In the terminal:

Write sudo before the command to be executed

It prompts for user's password,

Press Enter and executes the administrative task.

Graphically :

When you open an application that requires root privileges (sinaptic, gparted, firewalls …) password is automatically prompted and access to administrative tasks is provided.

These privileges are temporary, lasting a few minutes and go off automatically for safety.

To perform system tasks from the windows environment, Nautilus (a graphical file manager for Gnome) must be used with root privileges. There are several ways to achieve this:

Run Nautilus as root with the following command:

gksudo or gksu nautilus path / to / directory.

For example if the user has to edit its home folder, issue the following command:

gksu nautilus / home / user

or

gksudo nautilus / home / user

Note: "user" should be replaced with the appropriate username.

Nautilus-gksu

To install nautilus-gksu from the terminal, issue this command (does not work in Ubuntu 11.10, please read the notes below):

sudo aptitude install nautilus-gksu

Once installed, restart Nautilus from the terminal running the following command:

killall nautilus

From now on the user will have the option to Open any folder or file as administrator by clicking the right mouse button.

For Ubuntu 11.10: The "open as administrator" does not appear after installing "nautilus-gksu" but it can still be done the old fashioned way (with a script):

Open "/home/Username/.gnome2/nautilus-scripts/",

right click> Create Document> Empty document

Name it something like "open_as_admin".

Open the document and paste the following code:

#! / Bin / bash

for uri in $ NAUTILUS_SCRIPT_SELECTED_URIS;

do

gksudo "gnome-open $ uri"

done

If the above code does not work, change it by the following:

#! / Bin / bash

for uri in $ NAUTILUS_SCRIPT_SELECTED_URIS;

do

gksudo nautilus "$ uri"

done

Then hit save, close it and right click on the file, select "Properties> Permissions and activate the box" Allow executing file as program ".

The user can now get root access to any directory or file, by right clicking on it then> Scripts> Open as administrator.

Login as root on an ongoing basis

If the user needs to log in as root to do something specific, the root password must be activated. To do so, user must run:

sudo passwd root

Enter a password and hit enter.

But since it is dangerous to have a root password set, it is recommended to disable it after performing the necessary tasks. To do this run:

sudo passwd -l root

Or edit the / etc / passwd file with:

sudo gedit / etc / passwd

Seek the line:

root: x: 0: 0: root: / root: / bin / bash

Delete the X only (not the whole line) and save.

A user can also get permanent access as root on the terminal (without having to type sudo continuously) running this command:

sudo su

It is dangerous to stay in the terminal when logged in as root. Always type "exit" when finished and before closing the terminal.

Note: to recognize what is the current logged in user, simply look for the $ and # symbols at the line where the commands are entered (prompt):

user at user-desktop: ~ $ It is the user's account (normal)

root at user-desktop: ~ # It is the root account

The whoami (who I am) command can also be used.

If an application is run with root privilegies (Nautilus or Synaptic), the GTK theme switches to a different one. Even though it may be good to have a way to differentiate which user is running the application, there is some people that prefers to keep the same theme as its GTK3 user.

In order to do that, the user must create symbolic links, by running the following commands in a terminal:

sudo ln -s ~ / .icons / root /.icons

sudo ln -s ~ / .themes / root /.themes

Continue reading about users and groups in linux .

Source

Leave a Reply