Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to be able to run the command /usr/bin/evrouter as root, without being requested a password.

See for the followed example.

my sudoeurs file looks like this:

lucian@lucian-P35-DS3:~$ sudo cat /etc/sudoers
# This file MUST be edited with the 'visudo' command as root.
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
# See the man page for details on how to write a sudoers file.
Defaults        env_reset

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
lucian  ALL=(root) NOPASSWD: /usr/bin/evrouter

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

#includedir /etc/sudoers.d

When running evrouter after changing the sudeurs file, i get this

/usr/bin/evrouter -d /dev/input/by-id/usb-TopSeed_Tech_Corp._USB_IR_Combo_Device-*                                                                                                
/usr/bin/evrouter: error opening device /dev/input/by-id/usb-TopSeed_Tech_Corp._USB_IR_Combo_Device-event-ir: Permission denied

Edit: the output should be:

lucian@lucian-P35-DS3:~$ sudo /usr/bin/evrouter -d /dev/input/by-id/usb-TopSeed_Tech_Corp._USB_IR_Combo_Device-*
[sudo] password for lucian: 
device  0: /dev/input/by-id/usb-TopSeed_Tech_Corp._USB_IR_Combo_Device-event-ir: TopSeed Tech Corp. USB IR Combo Device 
device  1: /dev/input/by-id/usb-TopSeed_Tech_Corp._USB_IR_Combo_Device-if01-event-ir: TopSeed Tech Corp. USB IR Combo Device 
/usr/bin/evrouter: error querying device /dev/input/by-id/usb-TopSeed_Tech_Corp._USB_IR_Combo_Device-if01-ir: Inappropriate ioctl for device
/usr/bin/evrouter: error querying device /dev/input/by-id/usb-TopSeed_Tech_Corp._USB_IR_Combo_Device-ir: Inappropriate ioctl for device
Display name: :0
share|improve this question

closed as off topic by Iain, Ward, Scott Pack, mailq, Shane Madden Nov 9 '11 at 0:23

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

What is the output of sudo /usr/bin/evrouter -d /dev/input/by-id/usb-TopSeed_Tech_Corp._USB_IR_Combo_Device-* – 84104 Nov 6 '11 at 15:34
@user84104 see the edits. It should be allowed to open the requested files – quamis Nov 6 '11 at 15:39
Your output doesn't show you running evrouter with sudo. What happens if you do that? – Bill Weiss Nov 6 '11 at 15:46
@BillWeiss see the edited part – quamis Nov 6 '11 at 15:51
No. We would like you show the 'real' output when running sudo /usr/bin/evrouter -d .... – quanta Nov 6 '11 at 15:57

You can narrow this down by starting with very broad sudoers permissions and narrowing it down. First try this in your /etc/sudoers:


if that works, try making it more restrictive:

lucian ALL = NOPASSWD: /usr/bin/evrouter

and then

lucian ALL = (root) NOPASSWD: /usr/bin/evrouter

Also try putting lucian in the sudo group with vigr. That should work, via the last specification in your sudoers file (although the permissions will be broader than what you want).

Als sudo should be logging to /var/log/messages or /var/log/sudo.log or similar. Check the logs.

share|improve this answer

I think you forget to add the end of line in your sudoers file : lucian ALL=(root) NOPASSWD: /usr/bin/evrouter -d /dev/input/by-id/usb-TopSeed_Tech_Corp._USB_IR_Combo_Device-* Acutally, you can only launch the command /usr/bin/evrouter without parameter.

share|improve this answer
If you don't define a parameter list you can supply any number of parameters to the command. – Iain Nov 6 '11 at 16:58
@Dom: adding a parameter list doesn't seem to make a difference – quamis Nov 6 '11 at 18:15
See the sudoers man page, if you don't specify command arguments in the sudoers file, sudo will accept any arguments you specify when you run the command. – Phil Hollenback Nov 6 '11 at 19:56
up vote -3 down vote accepted

I've fixed this by setting suid on the needed application, even if its not very secure, its my local desktop, so i trust its safe:)

share|improve this answer
Note to anyone who may see this in the future - this isn't a good thing to do. – Iain Nov 8 '11 at 17:44
suid is evil. Don't do it! Don't do it! Don't do it! – mailq Nov 8 '11 at 19:20
i know its evil, but i got no helping answers i needed to get things done – quamis Nov 8 '11 at 21:32
That's because you asked the wrong question. – Shadur Mar 11 '14 at 12:29

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