I have tried this command from the link below to block SSH incoming into my computer.


sudo ufw block ssh

However, I got all the commands syntax listing in return. Any thoughts? Thank you.


The desired command seems to be deny instead of block.

sudo ufw deny ssh

The documentation you referenced seems outdated.

The correct usage seems to be sudo ufw deny ssh. Changes are that ufw is not even enabled on your system, check with sudo ufw status. If you enable, please make sure you are fine with the default DENY ALL.

If you do not need an ssh server at all, you may be better of by disabling. Issue sudo service ssh stop, assuming your system is using the default upstart system. If that works, you can do sudo echo "manual" >> /etc/init/ssh.override. See upstart documentation (I had to look it up myself, I normally just lazily move the script) to make it permanent.

Hope this helps,

  • Thank you for the answer. I used $ sudo ufw deny ssh from your answer and it came back : Rule added. Now my question is, do I have to do it every time I turn on the computer or do I need to enter it into some config file ? If so, do you know by any chance what is the filename ? I also tried $ sudo service sshd stop , and I got : Failed to stop sshd.service: Unit sshd.service not loaded. How would I load the sshd.service ? – pat_220 Sep 13 '16 at 8:08
  • It may be that you did not have ssh running at all. Probably not, otherwise you could have stopped it. You would need the ssh deamon running to be able to handle incoming ssh requests. Perhaps you could clarify why you wanted to block ssh in the first place? – Jeroen Sep 13 '16 at 8:21
  • oh yeah, to get a ssh server you probably would need to install it first: sudo apt-get install openssh-server see this doc. I also think I had the service name wrong (I was outdated myself ;-), please try sudo service ssh stop see if that works. – Jeroen Sep 13 '16 at 8:36

Your Answer

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

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