Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


sudo cd | 23 comments | Create New Account
Click here to return to the 'sudo cd' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
sudo cd
Authored by: aixccapt99 on Feb 18, '05 08:29:23PM

I'm not 100% sure on this, but I believe it's because cd is not an executable command (ie a program), but rather a shell command. The shell is what holds the concept of your current/working directory, so cd just instructs the shell to change that directory. The system has no such concept; when the shell issues system commands it includes your working directory in the command paths automatically.

So point being, sudo runs programs with root privileges. Since cd is not a program, it doesn't work. You need to do sudo -s to get a new instance of your shell, as root, and then that shell can cd into protected locations.



[ Reply to This | # ]