Why is visudo saying there's a syntax error?

I'm using CentOS

uname -a
Linux mydomain.com 3.2.29-48.63.amzn1.x86_64 #1 SMP Sat Sep 15 01:43:12 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

I'm trying to add this command to my /etc/sudoers file using visudo ...

Cmnd_Alias     CHOWNCMD = /bin/chown jboss:jboss /usr/java/jboss/server/default/deploy/myclient*.ear

but when I try and save it is complaining about a syntax error. I can run this command (everything after the "=") on a command line, so I'm having a hard time figuring out what visudo is complaining about. Any suggestions how to modify the above line to get visudo to behave?

  • Dave

Solution 1:

The colon is the syntax error. Try

Cmnd_Alias     CHOWNCMD = /bin/chown jboss\:jboss /usr/java/jboss/server/default/deploy/myclient*.ear

That validates for me (Fedora 16, sudo 1.8.3p1), and in addition it gives me the privilege to use under sudo.