sudo cd... command not found?

techlists at phpcoderusa.com techlists at phpcoderusa.com
Thu Dec 22 15:21:54 MST 2022


Thanks Dale,

Worked!!  Thanks!!

I noticed it made me the root user.

What is the difference between sudo -i and sudo su?

In my research it appears that both change to user to root along with 
changing the UID.  I've been using sudo -i to solver this issue for 
years while not fully understanding it.

I assume sudo elevates the user's permissions however they stay that 
user and their UID does not change??

Keith


On 2022-12-21 21:47, Dale Farnsworth wrote:
> [I sent this message yesterday, not sure why it didn't make the list.
> Re-sending]
> 
> sudo only runs commands found in $PATH.
> cd is a built-in shell command, therefore sudo can't find it.
> The fix is to do su or "sudo su" to get a root shell, and then in the
> root shell do a cd to the restricted directory.
> 
> Dale
> 
> On Tue, Dec 20, 2022 at 6:27 PM Keith Smith via PLUG-discuss
> <plug-discuss at lists.phxlinux.org> wrote:
> 
>> Hi,
>> 
>> Not sure what is going on here:
>> 
>> cd <path> results in message "-bash: cd: <path> : Permission
>> denied".
>> 
>> Then I add sudo : sudo  cd <path> results in message  :  "sudo: cd:
>> command not found".
>> 
>> Any help is much appreciated!!
>> 
>> Keith
>> ---------------------------------------------------
>> PLUG-discuss mailing list: PLUG-discuss at lists.phxlinux.org
>> To subscribe, unsubscribe, or to change your mail settings:
>> https://lists.phxlinux.org/mailman/listinfo/plug-discuss


More information about the PLUG-discuss mailing list