but the two commands above behave differently. 'su <user>' gives the current user the identity of <user> whereas 'su - <user>' gives the current user the identity of <user> together with <user>'s environment that would be obtained by logging in as <user>.
Often a user will become root using just 'su', try to run a command (eg, ifconfig), and get a 'command not found' error. For example:
The reason is that regular system users and the root user have different PATH environment variables. When you type a Linux command, the shell will search the user's PATH to try to locate the command to run. It starts searching each directory on the PATH until a match is found.
Often when a person reports a problem, in IRC or otherwise, they are referred to this page. In debugging WHY a given binary cannot be seen, it is helpful to view the currently effective PATH with: echo $PATH
Commands for regular users are mostly located in /usr/bin, and /bin and occasionally /usr/local/bin -- the /usr/local/* path prefix is not used for packaging by default upstream. However, root commands are mostly located in /usr/sbin, and /sbin and occasionally /usr/local/sbin As such, root's PATH reflects this.
When you become root by using 'su -', you also adopt root's PATH whereas using just 'su' retains the original user's PATH, hence why becoming root using just 'su' and trying to run a command located in /usr/local/sbin, /usr/sbin, or /sbin results in a 'command not found' error. For a more detailed explanation, see the bash manual page (man bash), particularly the section on INVOCATION and login shells.
So you either need to specify the full PATH to the command if you just used 'su' (eg, /sbin/ifconfig) or use 'su -' when becoming root.