Monday, September 1, 2008

Linux - Acquiring super user environment/commands

To run the super user commands in linux you should login as root. Or else either you can use 'su' command to possess the superuser (root) power or by using 'sudo' command we can run the super user command provided the sudo access is granted by the superuser (root).

Let me take you thru' su command of linux. If you are normal linux user you will be provided with $ sign prompt and you won't be given a permission to run superuser (root) commands.

$ reboot
reboot: must be superuser.
$

If you are a user and you want to have super user power, you can use 'su' command to acquire the root user environment.

$su #Acquires root user environment
Password:
#reboot #restart the linux system.

This command also used to acquire other users environment. For example the apache server runs as 'jacob' user process and you want to have control over that. You can use the command su following the username .

$su jacob #Acquires jacob user environment
Password:
$apachectl restart #restart the apache server

If you are the superuser (root), then to acquire a user environment you can just use the su following the username, no need key in the password.

#su jacob #Acquires jacob user environment
$apachectl restart #restart the apache server

If sudo is configured for the for the user jacob. He can run the super user commands as shown below:

$sudo reboot #restart the linux system.

--
Anand
anand.sadasivam@googlemail.com

No comments: