Ubuntu – UFW Enable requires y prompt, how to automate with Bash Script

Ubuntuufw

I'm trying to automate the setup of UFW on an Ubuntu 16.04 instance. However when I type:

sudo ufw enable

I get prompted to enter yes or no, is there a way to feed it yes or set it automatically to start without getting stuck with a prompt?

Best Answer

How about:

$ echo "y" | sudo ufw enable
Related Topic