Difference Between su and su – (su minus sign)

Difference Between su and su – (su minus sign)

When you use “su” with the minus sign, the “login profile” of the user that you are trying to login as is executed. Meaning that it is like you were login exactly as that user.

If you do not use it (the minus sign), you do not inherit the login profile of that user.  So you may have to use the full path of most programs in order to access them.  Instead of  “$  iptables  status” you will need to use the full path to that command :  “$  /etc/init.d/iptables  status” if you do not use the minus sign

So if you plan on using su, it might be a good thing to always use the minus sign.

Reference
Use “su” with the minus sign
http://www.wellho.net/mouth/2203_Always-use-su-with-minus-And-where-do-programs-come-from-.html

Let's share thisShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn