sucommand is used has been changed. By default execution of the
sucommand no longer provides you with expected user environmental variables.
In the case of a simple switch to administrative user
suwith no arguments the expected root's
PATHvariable is no set properly.
SymptomsHere is an example:
$ su Password: # reboot bash: reboot: command not found # adduser bash: adduser: command not found
SolutionThe trick on how to fix this inconvenience is to explicitly tell the
suto set environment variable as if the user logs in directly. This is can be done by the use of
Excerpt from the
man sumanual page. -, -l, --login will provide an environment similar to what the user would expect had the user logged in directly.
$ su - OR $ su -l