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?


How about:

$ echo "y" | sudo ufw enable
  • Will try this right now! – Adron Jul 21 '16 at 18:48

You could use:

$ sudo ufw --force enable

yes allows you to answer all questions from a program with y.

yes | sudo ufw enable

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.