Smart way to do it is to setup a cron job to run shell script that will flush (or restore to default working ruleset) iptables rules every 10 minutes. With this approach, even if you mess up your iptables rules and loose ssh, you can simply wait for 10 minutes and reconnect to ssh. Take your time and check that cron job is working correctly and if it is, continue with ufw\iptables setup or correct mistakes.
On 29.08.2017 01:01, Tom Browder wrote: > Installing and enabling ufw sounds easy, but how is the existing set > of iptables rules treated? I want to use ufw on a remote server and > losing ssh would be disastrous! > > Thanks. > > -Tom >