unable to cd when using sudo
base function cd "change dir" seems to be missing. When I do sudo cd
$ sudo cd config
Password:
sudo: cd: command not found
strange that I can not cd to a dir using sudo.
Bryce Harrington said on 2007-02-12:
Actually cd is not a program, but a built-in for the bash shell. So you don't really 'run' it in sudo like that.
Instead, try doing this:
$ sudo bash
# cd
# [other commands...]
# exit
$
Hope this helps.
tokj said on 2007-02-12:
It is normal. There is no need to be superuser for using cd, so cd is not recognized as a command to be used with sudo. ;)
Gabriel PatiƱo said on 2007-02-12:
The cd command is a bash internal command, if you want an interactive root session, try using 'sudo -i'
After that, you will be working as root (be carefull). To leave the root session, type exit, or ctrl+d
tokj said on 2007-02-17:
It would be nice if you mark this problem as "solved" if you haven't any other problems or questions.
Best regards