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 wish to create a shortcut key for reboot/shutdownfor all the users (including non-root users). I have tried creating a custom shortcut key Ctrl+R and assigned it to the command “gksu reboot” however Ubuntu requires root privileges to execute the command and throws up the message

Failed to run reboot as root The underlying authorization mechanism (sudo) does not allow you to run this program. Contact the system administrator.

I do not wish to give root privileges to the users and essentially want to execute the Shutdown/Reboot (that is usually accessed through the gear icon by all the users) through commands using shortcut keys

Can someone please help?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

You can allow all users to run only the reboot command with no password, gksu should pick up this permission correctly. Add this to your sudoers file:

ALL ALL=NOPASSWD: /sbin/reboot

PLEASE don't edit sudoers directly. Use sudo visudo to get an editor, which will syntax-check the file once you save it. Append that line at the end, then save and exit it. If visudo finds a problem it will help you so you don't lock yourself out of your system.

share|improve this answer
    
That worked perfectly! Thanks for the help and also for the suggestion to use visudo. Interestingly the GUI option somehow does not need editing sudoers file. –  Srini Jan 15 at 20:56
add comment

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.