what is mean by su and su - ?

Dell / Inspiron n5010
January 4, 2011 at 23:19:36
Specs: Windows 7, 2.261 GHz / 2934 MB
pls provide me solution.

See More: what is mean by su and su - ?

January 5, 2011 at 03:08:11
Open a terminal.
Type "man su".
All will be revealed.

Report •

January 5, 2011 at 06:59:53
Executing su (with no -) successfully, gives the user root privileges but retains the user's original environment (i.e. HOME directory) and shell variables (i.e. PATH)

Executing su - is similar to logging in directly as root and root's environment (HOME, PATH, etc) is set.

Report •

October 16, 2011 at 04:34:06
When you execute su -, only the PATH variable is changed to the one used when logging in. The rest of them (HOME included) remain unchanged.

Report •

Related Solutions

October 17, 2011 at 10:38:58

I must respectively disagree with you. Successfully executing su - provides a new login shell; it's like logging into the root account. Try this example:

From the normal user account:

export A=6

Now, execute:

su -

echo $A

and you will see that $A is undefined because the new root shell doesn't define $A. Of course, if you simple executed:


$A would still equal 6.

In fact, if the root shell is different from the normal user's shell which typically happens in legacy unix - not so much Linux where mostly Linux uses bash.

Let's assume root uses sh and normal users use ksh. Executing:

su -

changes the shell to sh

If you don't believe me, google:

difference between su and su -

Report •

Ask Question