/usr/sbin is not in $PATH on Debian 11 bullseye. Is this correct?

Discussion about development of the Debian OS itself
Post Reply
Message
Author
postcd
Posts: 73
Joined: 2022-01-08 18:33
Has thanked: 24 times
Been thanked: 1 time

/usr/sbin is not in $PATH on Debian 11 bullseye. Is this correct?

#1 Post by postcd »

Hello,

$ echo $PATH

Code: Select all

/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
The traffictoll installed by "pip3 install traffictoll" failed to work because it could not access tc (/usr/sbin/tc)

So i did:

Code: Select all

export PATH=$PATH:/usr/sbin:/home/$(whoami)/.local/bin
echo "export PATH=$PATH:/usr/sbin:/home/$(whoami)/.local/bin" >> ~/.bashrc
Is it correct that it is not included or i or some app accidentally removed /usr/sbin from PATH?

p.H
Posts: 2676
Joined: 2017-09-17 07:12
Has thanked: 3 times
Been thanked: 61 times

Re: /usr/sbin is not in $PATH on Debian 11 bullseye. Is this correct?

#2 Post by p.H »

/sbin and /usr/sbin are not in normal users' $PATH, only in root's $PATH.

User avatar
craigevil
Posts: 5399
Joined: 2006-09-17 03:17
Location: heaven
Has thanked: 22 times
Been thanked: 31 times

Re: /usr/sbin is not in $PATH on Debian 11 bullseye. Is this correct?

#3 Post by craigevil »

I added this to my bashrc

Code: Select all

# Fix PATH
PATH=$PATH:/home/pi/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/pi/.local/bin:
Raspberry PI 400 Distro: Raspberry Pi OS Base: Debian Sid Kernel: 5.15.69-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"
My Giant Sources.list

reinob
Posts: 1060
Joined: 2014-06-30 11:42
Has thanked: 53 times
Been thanked: 14 times

Re: /usr/sbin is not in $PATH on Debian 11 bullseye. Is this correct?

#4 Post by reinob »

@postcd,

You do realize that "tt has to be run as root" (from https://github.com/cryzed/TrafficToll).
/sbin, /usr/sbin and /usr/local/sbin will be in root's PATH,
(if you run your command with sudo or become root using "su -" or just login as root, depending on your config.)

fuzzyeric
Posts: 1
Joined: 2022-09-17 03:07

Re: /usr/sbin is not in $PATH on Debian 11 bullseye. Is this correct?

#5 Post by fuzzyeric »

Seems to be problematic for PAM_mount, particularly pmvarrun.

fuzzy@client0008 ~ $ sudo -i
[sudo] password for fuzzy:
HXproc_run_async: pmvarrun: No such file or directory
root@client0008:~# whereis pmvarrun
pmvarrun: /usr/sbin/pmvarrun /usr/share/man/man8/pmvarrun.8.gz
root@client0008:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
root@client0008:~# exit
logout
HXproc_run_async: pmvarrun: No such file or directory
fuzzy@client0008 ~ $ echo $PATH
/home/fuzzy/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
fuzzy@client0008 ~ $

jmgibson1981
Posts: 170
Joined: 2015-06-07 14:38
Has thanked: 6 times
Been thanked: 7 times

Re: /usr/sbin is not in $PATH on Debian 11 bullseye. Is this correct?

#6 Post by jmgibson1981 »

Code: Select all

$ head -n 1 /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/share/games:/opt/kodimatrix/bin"
I get lazy. I don't see a problem with this. If it needs root it will demand it anyway so it will still require authentication. Saves me from having to remember which ones I can and can't do.

User avatar
Head_on_a_Stick
Posts: 13992
Joined: 2014-06-01 17:46
Location: /dev/chair
Has thanked: 51 times
Been thanked: 77 times

Re: /usr/sbin is not in $PATH on Debian 11 bullseye. Is this correct?

#7 Post by Head_on_a_Stick »

fuzzyeric wrote: 2022-09-17 03:11 Seems to be problematic for PAM_mount, particularly pmvarrun.

fuzzy@client0008 ~ $ sudo -i
[sudo] password for fuzzy:
HXproc_run_async: pmvarrun: No such file or directory
root@client0008:~# whereis pmvarrun
pmvarrun: /usr/sbin/pmvarrun /usr/share/man/man8/pmvarrun.8.gz
root@client0008:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
root@client0008:~# exit
logout
HXproc_run_async: pmvarrun: No such file or directory
fuzzy@client0008 ~ $ echo $PATH
/home/fuzzy/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
fuzzy@client0008 ~ $
Using sudo should add /usr/sbin/ to PATH:

Code: Select all

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
$ sudo -i
# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#
Can we see

Code: Select all

sudo -l
EDIT: disregard, see below.
Last edited by Head_on_a_Stick on 2022-09-17 10:24, edited 1 time in total.
Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher.

p.H
Posts: 2676
Joined: 2017-09-17 07:12
Has thanked: 3 times
Been thanked: 61 times

Re: /usr/sbin is not in $PATH on Debian 11 bullseye. Is this correct?

#8 Post by p.H »

Head_on_a_Stick wrote: 2022-09-17 10:07 Using sudo should add /usr/sbin/ to PATH
It does:
fuzzyeric wrote: 2022-09-17 03:11 root@client0008:~# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
But I guess it happens after PAM stuff.

Post Reply