I have a script that occasionally needs to run the command "service udev reload" but cannot as it needs root access. I don't want to stay logged in as root all the time, so I'm wondering if there is a way to change permissions for this command.

I'm on 12.04.

Any ideas?


From the man page: sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy.

So, this is the proper way to restart a service:

sudo service udev reload

if you do not want to do it by hand, you can always add an entry in crontab to execute the command at time intervals

  • Just to check, this would have to be in the /etc/cron.hourly or /etc/cron.daily (or related variants) folders, right? – saiarcot895 Apr 24 '14 at 23:32
  • yes, adding a script in those directories, or edit crontab with sudo crontab -e and add a line with command/script putting the date and time you want. Refer to man crontab for more help. – girardengo Apr 24 '14 at 23:48
  • I don't really know the answer to OP's question, but I think this is missing the point. I think he already has a script that runs sudo service udev reload, but he wants to be able to run that specific command without sudo and still have it work. – jarvisschultz Apr 25 '14 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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