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.
nmcli nm wifi off; nmcli nm wifi on
?nmcli
doesn't require root access.