This is what I plan to do:
#!/bin/bash
sudo -i <<'EOF'
iptables-save | awk '/^[*]/ { print $1 }
/^:[A-Z]+ [^-]/ { print $1 " ACCEPT" ; }
/COMMIT/ { print $0; }' | iptables-restore
EOF
I will save the above and call it cleariptables.sh. I will set it as executable.
It will be placed in a folder called bin in the following path: /home/cymbal/bin/
(where cymbal is the username)
I will create a shortcut to cleariptables.sh on the desktop. The contents of the shortcut will be:
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Icon[en_US]=nm-device-wired
Name[en_US]=ClearIPtables
Exec=gksudo /home/cymbal/bin/cleariptables.sh
Comment[en_US]=Flush iptables filters
Name=ClearIPtables
Comment=Flush iptables script
Icon=nm-device-wired
Whenever I click on the desktop shortcut, I will be prompted to enter the password and the script will run.
Question: Clicking on the desktop shortcut prompts me for the password. As there is a sudo -i in the script, will I be prompted again for the password?