Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] DEbian 12.5 $PATH

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
rac8006
Posts: 29
Joined: 2016-05-02 15:33

[Software] DEbian 12.5 $PATH

#1 Post by rac8006 »

I just upgraded to bookworm. I noticed that /bin is a symbolic link to /usr/bin and /sbin is a symbolic link to /usr/sbin. Is there a reason that the normal user $PATH does not have /sbin in it? Also noticed that the normal user $PATH has /usr/bin and /bin isn't the redundant?
I was looking into this because several times I would try to run a program and would get the message command not found.

PS when does .profile in the user home directory get called. I made a change to the $PATH. But when I open a new konsole it does not get the change.

User avatar
sunrat
Administrator
Administrator
Posts: 6511
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 119 times
Been thanked: 489 times

Re: [Software] DEbian 12.5 $PATH

#2 Post by sunrat »

Standard users are not supposed to be allowed to run commands in /usr/sbin/. The recommended way to do so is escalate privileges with su - (note the dash) or with sudo.
Adding path in .profile should work but you would need to log out then back in before it works. It's a dirty hack though.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

rac8006
Posts: 29
Joined: 2016-05-02 15:33

Re: [Software] DEbian 12.5 $PATH

#3 Post by rac8006 »

Thanks for your response. I've been using Linux for years. I was on stretch on my desktop and Wheezy on my WD My Clouds and even a later versiopn on the DLink-323. In all that time I've never had the problem of programs not found after doing an su. I know that normal users should not run programs in /sbin or /usr/sbin. But after installing debian bookworm. I was constantly having commands not found. While trying to setup the bookworm. I had to google the error I received. But the information that I found mostly failed with command not found.
After getting your response. I see that my problem was not using the dash with the su command. For the last 20 years or more su worked. Thats why I thought I had to add sbin to the $PATH. I checked the $PATH after both su and su - and found why my command didn't work.
It's difficult working on Bookworn when a lot of what I used to do failed and I have no one to ask. I just found the forum.

PS still don't undersatnd why /bin and /usr/bin is in my $PATH.

jmgibson1981
Posts: 305
Joined: 2015-06-07 14:38
Has thanked: 11 times
Been thanked: 34 times

Re: [Software] DEbian 12.5 $PATH

#4 Post by jmgibson1981 »

While it may not be advisable I just create a PATH in my /etc/environment file

Code: Select all

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
This eliminates the entire issue. But it's not the proper way to go so do it at your own risk.

User avatar
sunrat
Administrator
Administrator
Posts: 6511
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 119 times
Been thanked: 489 times

Re: [Software] DEbian 12.5 $PATH

#5 Post by sunrat »

The $PATH was changed for Jessie IIRC. something something security... :D

Most of the commands you run as user will be in /usr/bin/ so it must be in user $PATH.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

rac8006
Posts: 29
Joined: 2016-05-02 15:33

Re: [Software] DEbian 12.5 $PATH

#6 Post by rac8006 »

Thanks again. My question was not why is /usr/bin in the path bu why is /bin? Since /bin/is a symboliclink to /usr/bin. When a comand does not exist /usr/bin/will be searched then /bin will be searched.

User avatar
sunrat
Administrator
Administrator
Posts: 6511
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 119 times
Been thanked: 489 times

Re: [Software] DEbian 12.5 $PATH

#7 Post by sunrat »

rac8006 wrote: 2024-03-14 03:43 Thanks again. My question was not why is /usr/bin in the path bu why is /bin? Since /bin/is a symboliclink to /usr/bin. When a comand does not exist /usr/bin/will be searched then /bin will be searched.
I guess it's redundant but remains for compatibility with older Debian versions when upgraded. usrmerge happened a couple of releases ago - https://wiki.debian.org/UsrMerge
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

rac8006
Posts: 29
Joined: 2016-05-02 15:33

Re: [Software] DEbian 12.5 $PATH

#8 Post by rac8006 »

Thank you. I forgot about backward compatibility.

Post Reply