The "su" is defined as the "Super User" which has the ability to open a session with the ID (identifier) of an another user, or starting a new login shell.
Sign in as a different user ID with "su"
When you enter your password, you will be logged in as "foo" user, you are always in the same working directory as before and you get the default settings of the previous user (login shell, variables of the environment, various permissions)
Start a new shell connection with "su -"
su - username
The use of the hyphen "-" forces the new shell connection to run with adjustment of variables environment and all the default settings according to user preferences.
For these reasons it is recommended if you log in as super user "root", use the command:
Back to previous shell
Type the "exit" command or combination of keys "Ctrl-d" to close the current shell and return to the previous one.
Comment: If the command line is not empty, use Ctrl-d which deletes the current character which hold the shell as root
Thanks to suspend the order can suspend the root shell and place it in the background.
The fg command allows to resume.
+ Stopped su
-If you type the command "exit" or "Ctrl-d" from the original login shell (initial), you are disconnected from the system (Unix - GNU / Linux).
-If you were logged in (in a shell) as root and you type the command "su user", the system will not require a password.
This document entitled « Using the su command » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.