Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4060

Beginners • Re: PATH=/ ... :$PATH does not work?

$
0
0
Following code executed:

Code:

PATH=/home/pi/bin:$PATH
but upon verification with

Code:

sudo visudo
this new path does not appear..

What now?
How to get a path properly programmed?
I take it `visudo` is in /home/pi/bin and you expect it to be executed by `sudo visudo`

If it is that ain't where its supposed to be and may not be the correct version. visudo should be in /usr/sbin. It should also be owned by root, with a group of root, and 755 permissions.

I'm also unclear why running sudo visudo might cause the contents of $PATH to appear.
SUDO changes the path it looks on I just discovered at https://unix.stackexchange.com/question ... serve-path

Not on RPiOS it doesn't. Both echo $PATH and sudo echo $PATH return the same thing. In my case that's /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games

sudo -i may change the path as may sudo -u or sudo -iu

Of course, the above assumes RPiOS which varies from some other distros by including the various sbin directories in the default path.

Lastly, you shouldn't need to manually add $HOME/bin to your PATH. If $HOME/bin exists most distros automatically add it to your PATH at login (via your .profile or .bashrc).

Statistics: Posted by thagrol — Tue Jan 07, 2025 10:37 pm



Viewing all articles
Browse latest Browse all 4060

Trending Articles