Sudo command does not recognise UFW

Hi, Going through Wills workshop in hardening the Server. Ran into first problem when updating on the terminal with apt update && upgrade -y update showed but did not upgrade, so had to run that with sudo upgrade by itself.
Next problem when getting into setting the Firewall. Sudo: ufw command not recognised.:
bluemonkey@racknerd-f82678:~$ sudo ufw allow ssh
[sudo] password for bluemonkey:
sudo: ufw: command not found

I have gone back to my home terminal and it shows up. This is where I logged out and went to the home terminal
bluemonkey@racknerd-f82678:~$ sudo ufw status
sudo: ufw: command not found
bluemonkey@racknerd-f82678:~$ exit
Connection to closed.
one-hundred@one-hundred:~$ sudo ufw status
[sudo] password for one-hundred:
Status: active

So it sees the command in home, but not on the server.

Just found I should have /usr/sbin in my PATH:


  • Edit your .profile: ( so I went into terminal cd /usr/sbin) then typed
    nano ~/.profile

  • Add the following line to bottom of file

export PATH=$PATH:/usr/sbin

But I tried that in so many ways and places I am completely lost.

Scrap the server and start again?

Hey, @100Monkeys!
Could it be that UFW is not installed on the server? A quick command could tell:

sudo apt install ufw

That was it :slight_smile: looking for the hard answers before starting with the easy solutions…

Thanks again V!

1 Like

Don’t mention it! Usually the hardest problems have the easiest answers! :wink: