LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-13-2013, 05:27 PM   #1
devUnix
Member
 
Registered: Oct 2010
Posts: 606

Rep: Reputation: 59
Sudeors File Not Working


I have this sudoer file /etc/sudoers.d/ux-cds-production-support

It has permission of 0440 and the contents are given here:

Code:
%UX-CDS-Production-Support.GG ALL=NOPASSWD:/bin/ls
%UX-CDS-Production-Support.GG ALL=NOPASSWD:/usr/bin/less
%UX-CDS-Production-Support.GG ALL=NOPASSWD:su /usr/sbin/lsof -v
%UX-CDS-Production-Support.GG ALL=NOPASSWD:su - tomcat /usr/bin/jstack
%UX-CDS-Production-Support.GG ALL=NOPASSWD:su - tomcat /usr/bin/jstat
%UX-CDS-Production-Support.GG ALL=NOPASSWD:su - tomcat /usr/bin/jstatd
%UX-CDS-Production-Support.GG ALL=NOPASSWD:su - tomcat /usr/bin/jmap
When I run any of the sudo commands as a user who is in the said group, I get these errors:

Code:
...
...
>>> /etc/sudoers.d/ux-cds-production-support: syntax error near line 5 <<<
>>> /etc/sudoers.d/ux-cds-production-support: syntax error near line 6 <<<
sudo: parse error in /etc/sudoers.d/ux-cds-production-support near line 2
sudo: no valid sudoers sources found, quitting

I have tried it on some other server and the same errors are appearing.

What could be wrong?

/etc/security/access.conf has got the entry for the said group.
 
Old 12-13-2013, 05:42 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Your file has syntax errors, which indicates that you have not edited it with visudo, as is recommended. Also, your su syntax is totally borked. Not that it would be needed at all here, since you are already using sudo.

Try it with this file:
Code:
%UX-CDS-Production-Support.GG ALL=NOPASSWD: /bin/ls
%UX-CDS-Production-Support.GG ALL=NOPASSWD: /usr/bin/less
%UX-CDS-Production-Support.GG ALL=NOPASSWD: /usr/sbin/lsof -v
%UX-CDS-Production-Support.GG ALL=(tomcat)NOPASSWD: /usr/bin/jstack
%UX-CDS-Production-Support.GG ALL=(tomcat)NOPASSWD: /usr/bin/jstat
%UX-CDS-Production-Support.GG ALL=(tomcat)NOPASSWD: /usr/bin/jstatd
%UX-CDS-Production-Support.GG ALL=(tomcat)NOPASSWD: /usr/bin/jmap
For the commands that have to run as user tomcat (I just guessed that that is what you wanted to do there) in a login shell you will have to use the -u and -i options, like this:
Code:
sudo -i -u tomcat /usr/bin/jstack
I strongly recommend to read the man pages for sudo, sudoers and su, since these commands are very critical to your systems security.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] /etc/hosts file not working keirvt Linux - Networking 4 04-28-2013 07:40 PM
Deleting a file no working. Lola Kews Linux - Software 43 10-15-2007 04:07 AM
Working out a file system? Grobbendonk Linux - General 2 03-22-2005 06:54 PM
File manager not working mandrag Mandriva 1 02-21-2004 02:20 AM
hosts file not working Tekime Linux - Networking 4 04-09-2002 08:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration