1

I need to run ifconfig wlan0 down and ifconfig wlan0 up with my common user.

How can I perform this?

GarouDan
  • 605

1 Answers1

1

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.

terdon
  • 54,564