ESXCFG Command not Found

I’ve come across this little issue whilst trying to make some changes to my ESX firewall.

I connected to my ESX Host using Putty and logged in using my non-privileged account (Called login) and then to run the ESXCFG commands i needed to change to my Root user.

So i entered su and put in the root password when prompted. I could see that my user account had been changed to root so i tried to run the esxcfg-firewall command.

This is what i found;

As you can see the command esxcfg-firewall command is not found. So i did a bit of research and came across this discussion on the VMware Communities Forum.

Steve Beaver posted the following: “I need you to SU a little different. Try this way “su -” the “-” add the paths to the account

So i tried that;

And as you can see it worked!! I wasn’t sure what the difference between su and su – was so i did a little digging and come across this post on Linux Questions which told me exactly what i needed to know.

“su” is equiv “su root” and “su -” equiv “su – root”

the diff between “su” and “su -” is “su -” you log in as a root with the env setting/profile (i.e you really log in as a root). just type “pwd” and you will be in the root home dir @ /root.

if you “su” only then basically you just “borrow” the root permission without having all the root env setting/profile . just “su” from your home dir and type “pwd”, you can see that you still in the user dir i.e /home/user

Note: The username login is a temporary user i setup so i could show you print screens. That user has now been removed.