I have always cheated and enabled root for SSH but am now trying to do it the right way and not allow root access through SSH.
I am missing something on the su and sudo commands. The "vdf" command does not work and esxcfg-??? command set is also not available. Can someone please help me understand how to use the administrative commands with sudo or su?
Thanks!
Sudo runs a command as root but doesn't use the root user's environment settings. Specifically the root user's path normally searches the /sbin and /usr/sbin directories and a by default normal users do not. Since those directories contain the commands you mentioned they won't work in sudo without specifying the full path to the command.
The following commands will add the appropriate directories to the search path if the user shell is the bourne shell (/bin/sh) or the bash shell (/bin/bash), after these commands are entered sudo will work without using the full path:
PATH=$PATH:/usr/sbin:sbin
export PATH
If you don't want to type them in every time add them to the end of your .profile or .bashrc file for the user in question.
RHCE, VCP
Blog: http://computing.dwighthubbard.info
What exactly are you running?
You may need to add something to your $PATH
--Matt
vdf or esxcfg-nics -l
standard commands
try
sudo /usr/sbin/esxcfg-nics -l
Try su - as well. The - makes the shell a login shell
If you found this or any other post helpful please consider the use of the Helpfull/Correct buttons to award points
I would highly advise avoiding su - if possible (it isn't always possible though), as it does not provde any audot trail of what was run like sudo does.
--Matt
Sudo runs a command as root but doesn't use the root user's environment settings. Specifically the root user's path normally searches the /sbin and /usr/sbin directories and a by default normal users do not. Since those directories contain the commands you mentioned they won't work in sudo without specifying the full path to the command.
The following commands will add the appropriate directories to the search path if the user shell is the bourne shell (/bin/sh) or the bash shell (/bin/bash), after these commands are entered sudo will work without using the full path:
PATH=$PATH:/usr/sbin:sbin
export PATH
If you don't want to type them in every time add them to the end of your .profile or .bashrc file for the user in question.
RHCE, VCP
Blog: http://computing.dwighthubbard.info