Re: Why use "su -" rather than "su"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mike McCarty wrote:
Paul Howarth wrote:

Mike McCarty wrote:


I have a general *NIX admin question. Why does one want to use
su -
as opposed to just su? I think I understand the difference in regards
to "su -" actually changes you to root, as if logged in that way, as
opposed to simply granting root privilege. But why do that? If I do
that, then I lose my path settings, and can't run my normal editor, which
is in ~/bin and so on. I just use "su".

What am I missing?



You're missing getting /sbin and /usr/sbin on your PATH, which you probably want for what you're about to do as root. If you already have those directories on your regular user's PATH (which is not the default), "su -" probably doesn't help you much. But it does for most people.

Paul.

Hmm. So I give up my regular editor in return for not having to type /sbin/

Well, I think I'll go along the way I am. I'm a pretty good typist.

I thought there might be a *real* reason, and I had missed something. I
was wondering if there might be some subtle problems which would bite
me later.

Actually, "su" will give you root's UID and GID, but not root's
_environment_ (path and such).  "su -" is roughly equivalent to doing
a full-on login as root, and thus getting not only the UID and GID, but
the environment as well.

See "man su" for details.
----------------------------------------------------------------------
- Rick Stevens, Senior Systems Engineer     rstevens@xxxxxxxxxxxxxxx -
- VitalStream, Inc.                       http://www.vitalstream.com -
-                                                                    -
-         The Navy's a bunch of wimps!  MY job's an adventure!       -
----------------------------------------------------------------------


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux