2

I'm trying to install ufw on my debian buster machine and get it to work. I already installed it using apt-get and if I try to do so again it says

> ufw is already the newest version (0.36-1)

So it seems to be installed but when typing ufw status or any other ufw command it says

bash: ufw: command not found

Am I missing some dependency? What am I doing wrong?

5
  • 3
    ufw is in /usr/sbin. What is you PATH set to?
    – xenoid
    Feb 13, 2020 at 8:16
  • 1
    This is secure path and accesible by sudoers . If you run sudo it will be availble (if user put in /etc/sudoers) Feb 13, 2020 at 8:47
  • ok thanks guys. using sudo seemed to do the trick
    – nik
    Feb 13, 2020 at 10:13
  • @user3728800 it is not a secure path. It is just a place with stuff that is mostly only useful to root. Feb 13, 2020 at 18:45
  • You are right but when normal user Don't hqve access . Its bot secure . You think secure is just firewalled. Im teaching linux and its better somehow easy undertod linux for user Feb 13, 2020 at 18:49

5 Answers 5

4

Command should be run by typing

sudo ufw <insert option here>

Otherwise you will get the error

bash: ufw: command not found

If all fails restart and reinstall ufw

1

Make sure to have /usr/sbin in your PATH:

  • Edit your .profile:

    nano ~/.profile
    
  • Add the following line to bottom of file

    export PATH=$PATH:/usr/sbin
    
0

Re Debian ufw and previous comments:

  • su first to gain root privileges
  • then in root@enlightened persona enter
    sudu ufw enable 
    

I hadn’t realised one had to sudo after su but it works

sudo ufw status
Status: active
-1

only use "su -" and the access to ufw command (and others) will work ok. with only "su" or logged as Root, dont work. Best regards!

2
  • Welcome to the site. Please reformulate your post, as it is unclear whether this is an answer or a question.
    – AdminBee
    Oct 13, 2020 at 8:12
  • 2
    It's unclear why this would solve the issue. Consider explaining what the issue is and how this solves it.
    – Kusalananda
    Oct 13, 2020 at 9:09
-1

While installing debian, it asks for the root name and the username (admin). Generally, it is usually the same for both in addition to the same password. Other times the name for root is not chosen and that name is taken by default: "root". If you log in with your username, even if you have administrator privileges, it will not recognize the ufw command. Try to login as "root". servername login: root password: yourpassword

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .