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.

Use “su” with the minus sign

Let's share thisShare on Facebook
Tweet about this on Twitter
Share on LinkedIn