Bug 310

Summary: sudo cd does not work
Product: Sudo Reporter: Faheem Mitha <faheem>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED INVALID    
Severity: normal    
Priority: low    
Version: 1.6.9   
Hardware: PC   
OS: Linux   

Description Faheem Mitha 2008-11-02 18:51:07 MST
I don't understand the following behavior, which I see on (at least)
Debian lenny as well as Gentoo.

faheem@orwell:~$ sudo cd Mail/
sudo: cd: command not found

This works for pretty much any other command I can think of.
There are two possibilties:

1) This is a bug, which makes me wonder why nobody else has reported
it. it was present in etch and is still present on upgrade to lenny.
I've run into it many times, and finally decided to report it.

2) I'm missing something.

                                                            Faheem.
Comment 1 Todd C. Miller 2008-11-02 20:08:06 MST
From the TROUBLESHOOTING file.

Q) When I try to use "cd" with sudo the command completes without errors but nothing happens.

A) Some operating systems include a /usr/bin/cd command for reasons unfathomable.  A "cd" command is totally useless since a child process cannot affect the current working directory of the parent (your shell).