1

My wireless is flaky so I'd like to be able to restart network-manager with a script WITHOUT having to type the root password.

I tried making a c program that does this:

setuid(0);
system("service network-manager restart");

And I set the permissions as follows:

sudo chown root:root suscript
sudo chmod 4755 suscript

But when I run it, I get this error:

stop: Unknown job: network-manager
start: Unknown job: network-manager

I guess something is wrong in the environment, but I don't know what. Can anyone help? Thanks.

By the way, this is xubuntu 14.04.

5
  • 1
    How about the commands nmcli nm wifi off; nmcli nm wifi on? nmcli doesn't require root access.
    – muru
    Jul 12, 2014 at 22:00
  • Or, in network manager, you can stop and start wireless. You probably do not need to restart network manager.
    – Panther
    Jul 12, 2014 at 22:09
  • @muru, I will try this, but I suspect network manager bugs contribute to my wireless problems, so I have generally found restarting it to be more useful than working within it.
    – smwilsonau
    Jul 12, 2014 at 23:50
  • In which case, you could switch another tool like wicd.
    – muru
    Jul 12, 2014 at 23:56
  • Believe me, I have considered it...
    – smwilsonau
    Jul 13, 2014 at 0:13

0

You must log in to answer this question.

Browse other questions tagged .