Matty
Matty

Reputation: 458

Script asking for confirmation despite using -y

I am trying to develop a script to setup software and some firewall rules. This is run on a fresh VPS while connected via SSH as the root user.

There are 2 points in the script where it appears to ignore '-y'

First Item:

apt update && apt upgrade -y && apt autoremove -y && apt autoclean -y

Causes this prompt to occur: Restart services during package upgrades without asking? Which I would like to just automatically select Yes.

Second Item:

ufw allow 1635/udp
ufw allow ssh
ufw enable

Causes this prompt to occur: Command may disrupt existing ssh connections. Proceed with operation? Which I would also like to just automatically select Yes.

Any help would be much appreciated. This 2 are currently stopping it from being a completely hands-off setup process.

Upvotes: 0

Views: 130

Answers (1)

Matty
Matty

Reputation: 458

Solved!

First Item

Discovered it was the apt upgrade causing the GUI prompt. This was resolved by updating it to: DEBIAN_FRONTEND=noninteractive apt upgrade -y

Second Item

Resolved by updating ufw enable to: yes | ufw enable

Upvotes: 2

Related Questions