Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
possible duplicate of How to Setup a root cron Job Properly –  Stef K Apr 25 at 0:15

1 Answer 1

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

share|improve this answer
    
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 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 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 at 21:05

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.