[sudo-users] cd problems

Todd C. Miller Todd.Miller at courtesan.com
Mon Feb 28 14:21:58 EST 2005


In message <BDD35658B859D51187AB00508BB8203005D2C7DF at nswcdlvaex12.nswc.navy.mil
>
	so spake Clift Robert T CONT DLVA (CliftRT):

> If I make a dir as root with permissions of 700 in /tmp I can't use sudo to
> cd to it as myself. The command appears to run and the log looks like it was
> successful but my cwd is the same as before I executed the sudo cd. 

>From the FAQ:

Q) When I try to use "cd" with sudo it says "cd: command not found".
A) "cd" is a shell built-in command, you can't run it as a command
   since a child process (sudo) cannot affect the current working
   directory of the parent (your shell).

Q) When I try to use "cd" with sudo the command completes without
   errors but nothing happens.
A) Some SVR4-derived OS's 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).

 - todd



More information about the sudo-users mailing list