0
Thanks

A few words of thanks would be greatly appreciated.

Using the su command




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:

su 

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
Password:
debian:/home/ccm# suspend

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

Notes


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

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Related

This document, titled « Using the su command », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

0 Comments