The utility sudo runs executables as root or another user. The command cd is not an executable, it is command that is built into the shell so you can not run it via sudo. [by hawkmage]
When running sudo <command> under a user login session, will that
change $PATH to be the root's $PATH during the running of sudo
If <command> relies on the user's $PATH, not the root's $PATH,
how can the user run sudo <command> successfully?
One way is to sudo su to be the root, change the root's
$PATH to be the user's, and run <command> directly.
I'm trying to devise a new sudoers configuration while building a new SOE and would like to force everyone (including system administrators) to use rootsh in favour of doing things like sudo -s, sudo bash, sudo tcsh and so forth. Effectively, use sudo to use any shell other than rootsh.
Is there a way to allow users to run anything they want except shells.