Notice that the command prompt is #. This type of prompt indicates root privileges. Using a console login as root is not recommended.
It is too tempting to keep working as root when you log in from the console. Log out of the system by typing logout.
The standard way to obtain root privileges is to assert them using the su command. You can use this command to become any user,
but its main purpose is in asserting root privileges. Now, log in again, this time using the user1 account.
Now type su to assert root privileges and enter the root password.
The su command starts a subshell that has root privileges. The prompt changes automatically as a signal (and a warning) that this shell has extra privileges. Now, test your root privileges.
Go to the /etc directory by typing cd /etc.
Create a new file by typing touch roottest. The touch command creates an empty text file.
Now, let us perform a specific task that requires root privileges. Delete this file by typing rm roottest.
Confirm that you want to remove the roottest file by typing y.
After completing tasks that require root privileges, you should surrender the root subshell. Type exit to exit this subshell.
Notice that the prompt changed again, indicating that you are a normal user. Sometimes you will need to move back and forth between your regular shell and a root subshell.
You can temporarily suspend a subshell with the suspend command. You can then move back to a suspended shell using the fg command. Let us see how this is done.
Type the su command to obtain root privileges, then enter the root password.
You are now back in a subshell that has root privileges. Type suspend to suspend the subshell with root permissions temporarily and return to the shell with normal user privileges.
Type fg to resume the subshell with root privileges.
Return to the shell with normal user privileges by typing suspend.
Now that you are a normal user again, go to the /etc folder by typing cd /etc.
Use touch to create a new file named roottest.
You can not create this file because you do not have root permissions. Now, type fg to return to the root subshell.