sudo cd command doesn`t appear to work.
hbo at egbok.com
Thu Aug 1 00:59:44 EDT 2002
Well, not exactly. With bash, at least, 'cd' is a shell builtin. It makes
that this would be so, since a subshell cannot, indeed, affect the
its parent. So cd has to be a builtin so that the CWD of the current shell
changed. This causes problems for sudo, since there's no '/bin/cd' command
^^ shell intercepts 'cd' command
sudo cd /tmp
^^ shell does nothing special with second arg.
Todd is correct in saying that problems like these are best dealt with by
adjusting group permissions on the protected directory, and group membership
of the user who wants access. In the rare case where you actually need a
root owned mode 700 (for example) directory, you are just going to have to
be root to cd there.
My sudoscript tool lets you have a root shell that is audited. This is still
pretty dangerous, and I wouldn't recommend it unless you are forced to give
the root shell. In that case, however, you would be able to cd to a
since you'd be root.
--On Wednesday, July 31, 2002 02:21:56 PM -0400 Igor Schein <igor at txc.com>
> On Wed, Jul 31, 2002 at 05:18:13PM +0100, menno koopmans wrote:
>> I am trying to run the command sudo cd /tmp on a unix
>> machine and no errors are returned when I run the
>> command however a pwd shows I haven`t changed
>> directory. I am able to use cd /tmp. I have tried
>> specifying full path names and that doesn`t help.
>> Any assistance would be much appreciated.
> cd operation takes place in a subshell, and doesn't effect
> CWD of your current shell.
> sudo-workers mailing list <sudo-workers at sudo.ws>
> For list information, options, or to unsubscribe, visit:
Howard Owen "Even if you are on the right
EGBOK Consultants track, you'll get run over if you
hbo at egbok.com +1-650-339-5733 just sit there." - Will Rogers
More information about the sudo-workers