How to run 'ifconfig wlan0 down/up' with a comm user?

What you need to do is give your user the right to run ifconfig. The way to do this is to edit the etc/sudoers file:

  1. Run sudo visudo

  2. Add this line to the file (if you are using default settings and you are in vi, hit i to be able to edit the file, esc to exit editing mode and :wq to save and exit):

    YOUR_USERNAME  ALL=NOPASSWD:/sbin/ifconfig
    

    Obviously, change YOUR_USERNAME to your actual username.

That's it, your user can now run /sbin/ifconfig without requiring the root password. Your script should now be ready to run.