When I logon to an ESX Server via putty, I use the su command to change to the root account. However I find that when I run commands like esxupdate query it reports that it is unable to find the command. When I logon to the ESX Server directly via an ILO console with the root user account there are no issues finding commands like esxupdate. Can someone explain what is going on and how I might be able to run these commands via putty?
Thanks.
Hi Joe,
Try su -
(su <space> <minus>)
As the previous poster stated, instead of changing into "Superuser" mode by running the command:
$su
Do so by running the comand:
$su -
The reason for this is that running "su -" changes the "PATH" to that of the "root" user. The directories listed in PATH are automatically searched when you run a command. The "esxupdate" command is located at "/usr/sbin/esxupdate"; and, "/usr/sbin" is already in the default PATH for the "root" user but not in the default PATH for non-root users. So, running the command "su -" also changes the PATH to that of the root user, and and the /usr/sbin directory is automatically searched for the "esxupdate" command.
To confirm the difference, login as a non-root user and run the command:
$echo $PATH
Then, run the command:
$su
Then, after you enter the root password the prompt changes to:
#
Now, run the command:
#echo $PATH
You'll see that the results are the same as when running the command as the non-root user.
Now, go back to the normal user via the command:
#exit
This should take you back to the non-root user, as seen by the shell prompt changing back to:
$
Now, "superuser" via the command:
$su -
Enter the root password, and the shell prompt changes back to:
#
Now, run:
#echo $PATH
You'll see that there are additional directories listed, including of course "/usr/sbin"
This answer might have been more than you bargained for; I just wanted to explain what was "going on".