31

Compare Debian (left) and Ubuntu (right):

$ ifconfig                                 $ ifconfig
bash: ifconfig: command not found          eth0     Link encap ...
$ which ifconfig                           $ which ifconfig
$                                          /sbin/ifconfig

Then as superuser:

# ifconfig                                 # ifconfig
eth0      Link encap ...                   eth0     Link encap ...
# which ifconfig                           # which ifconfig
/sbin/ifconfig                             /sbin/ifconfig

Furthermore:

# ls -l /sbin/ifconfig                     # ls -l /sbin/ifconfig
-rwxr-xr-x 1 root root 68360 ...           -rwxr-xr-x 1 root root 68040 ...

It seems to me the only reason I cannot run ifconfig without superpowers on Debian is that it's not in my path. When I use /sbin/ifconfig it does work.

Is there any reason I should not add /usr/local/sbin:/usr/sbin:/sbin to my path on Debian? This is a personal computer, I am the only human user.


Versions used (uname -a):
Ubuntu:

Linux ubuntu 3.13.0-51-generic #84-Ubuntu SMP Wed Apr 15 12:08:34 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Debian:

Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux
1
  • 1
    Great question - upvoted :) Incidentally, here's some history about Debian's decision not to put /usr/local/sbin:/usr/sbin:/sbin in the default PATH for ordinary users. Ubuntu's approach is seems more user-friendly for all but the most seasoned users.
    – user6860
    Commented Oct 30, 2017 at 2:44

2 Answers 2

34

In the Debian Policy is written that Debian follows the File Hierarchy Standard version 2.3. Note #19 on the standard says:

Deciding what things go into "sbin" directories is simple: if a normal (not a system administrator) user will ever run it directly, then it must be placed in one of the "bin" directories. Ordinary users should not have to place any of the sbin directories in their path.

For example, files such as chfn which users only occasionally use must still be placed in /usr/bin. ping, although it is absolutely necessary for root (network recovery and diagnosis) is often used by users and must live in /bin for that reason.

We recommend that users have read and execute permission for everything in /sbin except, perhaps, certain setuid and setgid programs. The division between /bin and /sbin was not created for security reasons or to prevent users from seeing the operating system, but to provide a good partition between binaries that everyone uses and ones that are primarily used for administration tasks. There is no inherent security advantage in making /sbin off-limits for users.


Short answer:

Is there any reason I should not add /usr/local/sbin:/usr/sbin:/sbin to my path on Debian?

As the note states, there is no reason why you should not do that. Since you're the only one using the system and you need the binaries in the sbin directories, feel free to add them to your $PATH. At this point let me guide you to an excellent answer how to do that correctly.

2
4

The only reason not to add them is that it makes tab completion of commands slower (since more directories are searched) and less effective (since there are more likely to be spurious matches from commands that don't make sense for non-root to use).

2
  • this is a very weak argument
    – Junaga
    Commented Dec 9, 2023 at 15:59
  • @Junaga: This is a very weak comment. Commented Dec 9, 2023 at 16:26

You must log in to answer this question.