Getting `-bash: ufw: command not found` error on debian

I am unable to run any command on debian, I am getting the above error.
Though when I use sudo same commands works.

Can someone please explain this behavior?

4

1 Answer

It is likely that the root user on your system is set up with a different default $PATH compared to that of non-root users.

The default paths are specified in /etc/profile, /etc/login.defs, /etc/login.conf or some other file either read by the shell, or by the login command. It differs from system to system.

The ufw command might, for example, live in /usr/sbin/. This directory usually contains tools that only root have any use for (many of them might even require root privileges, such as ufw, which is a firewall configuration tool).

There is no real need to have that directory in the $PATH of ordinary users.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like