• For example: I installed ifconfig
  • First i become root with "su"
  • Now I write "ifconfig" and get: "command not found".
  • I write "sudo ifconfig" and now it works.

This seems to happen with a lot of programs (not all).

Another example: apt-get does not seem to properly install applications if I'm not using the same method.

I should not need to write sudo if I'm already root.

Why is that? What can I do to fix this?


TL,DR: Use su --login or sudo.

Debian sets a different PATH for regular users. In /etc/profile, you can see that the defaults reserve /sbin for root:

if [ "`id -u`" -eq 0 ]; then
export PATH

type ifconfig says the utility resides at /sbin/ifconfig which is why regular users can't access it easily. When you run su with no arguments, the calling user's environment is preserved, including the PATH variable. sudo, on the other hand, provides a fresh environment and overrides the calling user's PATH.

The reason why you believe su is malfunctioning is because resetting PATH and IFS by default is legacy behavior. buster recently switched to the util-linux implementation of su which works differently; see /usr/share/doc/util-linux/NEWS.Debian.gz for details.

  • 1
    Or simply /sbin/ifconfig without sudo nor su – GAD3R Sep 7 '18 at 16:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.