Using the su command

Ask a question

The ''su''

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"

su username

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:

su -

rather than:


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.

ccm@debian:~$ su
debian:/home/ccm# suspend

[1]+  Stopped                 su
ccm@debian:~$ fg


-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.

Automatically lock the keypad (Num)
Sharing a Printer