I want to activate UFW on my Raspberry Pi 3 B as I have used it previously on another machine and was quite content with that software.

I have already downloaded UFW but I need to make sure that I don't lock myself out when I enable it.

I am remote controlling the Raspberry Pi 3 B over USB and VPN using USB tethering. A rather unusual setup. So please bear that in mind if replying in this thread.

Also, if I do get locked out, would it be possible to just remove some files from the SD card to prevent UFW from starting if I reboot?

  • how about just backing up the whole sd card and revert if something goes wrong?
    – Christian
    Commented Dec 22, 2017 at 11:34

2 Answers 2


Have a cron job that disables ufw every 10 / 20 minutes so if you do lock yourself out you can make a coffee, put your feet up and reflect on what you did wrong.

Remember to remove the cron job and enable ufw when you are done :-)

You can test the cron job by enabling ufw with allow all as default rules...


You can install and start ufw for testing without enabling the service. If you make a mistake, reboot. Also, IIRC, it won't bump out an established session. Open a window to install and configure, the leave this window open with the login session active while you open another and connect to test. Avoid the compulsion to close every session as you go and you should be fine.

  • 1
    How can I start the ufw service without enabling it? There is no UFW start command in the manual as far as I can tell.
    – Vesa
    Commented Dec 25, 2017 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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