Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

How can I perform this?

share|improve this question
1  
As far as I can tell, your script is printing today's date, killing firefox, restarting the network interface and relaunching firefox fullscreen. I still don't understand what you are trying to do. Do you just want firefox to load every time you log in? WHat's the point of ifconfig up/down? If you've just rebooted the interface has just been initialized anyway. I think we are still in XY problem territory :). Why do you want to execute this script?Is it just to get a fullscreen firefox? –  terdon Mar 28 '13 at 17:57
    
I will take the things clear. But explaining, I need restart firefox periodically. Because the firefox is showing something that need this behaviour. –  GarouDan Mar 28 '13 at 18:00
    
OK, so your problem is that you need to be able to run ifconfig as a normal user. –  terdon Mar 28 '13 at 18:02
    
terdon, I agree ˆˆ I think this will solve the problem. Do you know a way to do this? –  GarouDan Mar 28 '13 at 18:04
    
For future reference, please refrain from dramatically altering your question. The question that you first posed is significantly different than the one that you have now. If you need to make changes, try to keep as much of the original information there as possible (unless it's out right incorrect). If another question arises, then you need to ask that as a separate question. –  KronoS Mar 28 '13 at 21:52

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
terdon, sorry to reopen. But I had miss run. Didn't worked. This line user YOUR_USERNAME=NOPASSWD:/sbin/ifconfig is in my sudoers file, but I get bad permissions: SCIOCSIFFLAGS: Permission denied. Do you have a ideia to solve this? –  GarouDan Mar 28 '13 at 19:02
    
You are using the right user name I assume? –  terdon Mar 28 '13 at 19:05
    
Yes, for example, user garou=NOPASSWD:/sbin/ifconfig. –  GarouDan Mar 28 '13 at 19:06
    
@GarouDan sorry, my bad, I edited my answer, it should work now. Also, remember to close and save visudo the changes won't take effect until you do. –  terdon Mar 28 '13 at 19:25
    
@GarouDan did you run the command as sudo /sbin/ifconfig wlan0 down after updating the sudoers file? –  mazianni Mar 28 '13 at 19:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.