An immediate visible difference would be with PWD. Supposing you're
in /usr/src/linux, as your own ID, and then "su" to root.
-> 'su' would leave you in that same directory, with environment
variables retaining a whole lot of the values that were set up in
your user environment.
-> 'su -' puts you probably in directory /root, with the environment
set from root's .bashrc setup and such...
--
http://vip.hyperusa.com/~cbbrowne/internet.html
"The cost of living has just gone up another dollar a quart."
-- W.C. Fields
man suQuote:> When I change to root super user, I usually issue the command
> su -
> And this has worked for me well.
> What's the difference between "su -" and "su" for root super user?
And it works for other users as well.
'su - fred' will get you fred's login environment while 'su fred'
wont.
--
Universal Life Church http://andor.dropbear.id.au/~paulcol
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
xenaphobia: The fear of being beaten to a pulp by
a leather-clad, New Zealand woman.
Logon using "su -" then type "pwd; echo $PATH". Then logon usingQuote:> When I change to root super user, I usually issue the command
> su -
> And this has worked for me well.
> What's the difference between "su -" and "su" for root super user?
--
Louis-ljl-{ Louis J. LaBash, Jr. }
Sent via Deja.com
http://www.deja.com/
Read the man page! It says,
The optional argument - may be used to provide an
environment similiar to what the user would expect
had the user logged in directly.
Specifically that means su will retain the environment of the
shell which invokes it, except when the - option is used and
then the environment will be the same as a login shell for the
user su'd to.
So when does it make a difference? Well... maybe or maybe not in
several different situations.
Consider a large machine, where several different individuals
are responsible for various systems admin tasks. Each of them
wants to work in their own customized environment of course, and
obviously the root login shell cannot be made suitable for all of
them. Hence that root login shell might be a very bare bones
environment, and none of the admin users will ever use "su -" to
become root. Instead they all use just "su", and retain their
own environment (which with a few tricks in the init files can
be changed somewhat when the user is root).
On a workstation with only one person accessing root, root can be
customized in one specific way, and "su -" would be very
convenient to switch between a normal userid and root.
Another example might be when a system admin is asked to trouble
shoot a problem for a user. There is clearly no point in su'ing
to that user's account and running an errant program with the
environment being used by root, so using the - option will
provide the systems admin with an environment identical to the
user with a problem.
--
Floyd L. Davidson <http://www.ptialaska.net/~floyd>
su changes user, and only user.Quote:> When I change to root super user, I usually issue the command
> su -
> And this has worked for me well.
> What's the difference between "su -" and "su" for root super user?
>su changes user, and only user.
>su - builds up the users environment (such as roots $PATH) and takes him
>$HOME.
Villy
1. GETSERVBYNAME()????????????????????"""""""""""""
Hi,
Does anyone know why
struct servent *serv;
serv=getservbyname("exec","tcp");
gives a warning err of incomparible pointer type?
I also can't get rexec to function. It compiles ok....
Thanks
Kirk
2. PPP Question
3. """"""""My SoundBlast 16 pnp isn't up yet""""""""""""
5. differences among "ssh", "rlogin" and "telnet"
6. Changing le0 netmask...strange effects
7. Type "(", ")" and "{", "}" in X...
8. Problems with Apache 2.0.39 and PHP4
10. how to prevent "su" and "login"
11. KDE 2.2.2 can't use "smbclient" or "su"
12. "su" or "ksh" gives me not the suggested environment
13. calling "su" after "chroot"