LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 06-01-2017, 07:31 AM   #1
mf370
LQ Newbie
 
Registered: Jun 2017
Posts: 5

Rep: Reputation: Disabled
Permissions to execute commands as another user


I installed a program named IntelMQ, here it is all the steps that I made to install it in a CentOS 7https://github.com/certtools/intelmq/issues/981. During the installation two users are created: intelmq and apache.
The user apache is part of the GUI of the IntelMQ program and it has to execute commands as the user intelmq.
Basically, I can start the IntelMQ bots on the GUI, however I can't stop them. Probably is due to permission problems.

In the command line if I try to execute this command as the user apache it returns this:

Command:
Code:
sudo -u apache sudo -u intelmq /usr/bin/intelmqctl --type json stop abusech-domain-parser
Output:
Code:
Sorry, user apache is not allowed to execute '/bin/sudo -u intelmq /usr/bin/intelmqctl --type json stop abusech-domain-parser' as apache on localhost.localdomain
I'm very new to CentOS.
 
Old 06-01-2017, 07:53 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
I do not really understand why do you need double sudo.
Probably it can work without sudo -u apache too.
Also it is not related to centos at all.
I do not really know which user is allowed to execute /usr/bin/intelmqctl.
Finally I think you need to configure the sudoers, see visudo
 
Old 06-01-2017, 09:12 AM   #3
mf370
LQ Newbie
 
Registered: Jun 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
I already configured the sudoers file through visudo and that didn't solve my problem. I know this issue is not 100% related to CentOS, but in IntelMQ GitHub they weren't able to help me, because they are not familiarized with this OS.
 
Old 06-01-2017, 10:09 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,309
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
It's still not an OS issue but one of configuring /etc/sudoers properly. Why does it have to be just the account "apache" that should be able to launch /usr/bin/intelmqctl as as the account "intelmq" ?

Can you show what line you added to /etc/sudoers?
 
Old 06-01-2017, 10:16 AM   #5
mf370
LQ Newbie
 
Registered: Jun 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
The user apache gives access to the web interface of intelmq, and to execute any commands in the web interface, apache needs to run them as the user intelmq.

I added this line to the sudoers file: apache ALL=(intelmq) NOPASSWD: /usr/bin/intelmqctl

Is there a possibility that maybe my sudo is broken, and maybe that's why I can't execute the commands?

I'm really sorry to bother you guys with a subject that is not related to the OS 100%, but I don't know anywhere else to ask help.
 
Old 06-01-2017, 10:37 AM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,309
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Quote:
Originally Posted by mf370 View Post
I added this line to the sudoers file: apache ALL=(intelmq) NOPASSWD: /usr/bin/intelmqctl
Close. If it "apache" that you will have run sudo then /etc/sudoers needs to be set to allow that. However, be very precise with the options:

Code:
apache ALL=(intelmq:intelmq) NOPASSWD: /usr/bin/sudo -u intelmq /usr/bin/intelmqctl --type json stop abusech-domain-parser
See either of the following to get up to speed on configuring sudo
 
Old 06-01-2017, 10:48 AM   #7
mf370
LQ Newbie
 
Registered: Jun 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
apache ALL=(intelmq:intelmq) NOPASSWD: /usr/bin/sudo -u intelmq /usr/bin/intelmqctl --type json stop abusech-domain-parser
This line in the /etc/sudoers raises a JSON error in IntelMQ's web interface...

Anyway, thank you very much for your help. I will try to talk again with the IntelMQ team, because this is something related to the program and not the OS itself.

Once again, thank you!
 
Old 06-01-2017, 10:57 AM   #8
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,309
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
Quote:
Originally Posted by mf370 View Post
This line in the /etc/sudoers raises a JSON error in IntelMQ's web interface...
Does it work manually from the shell?

Quote:
Originally Posted by mf370 View Post
Anyway, thank you very much for your help. I will try to talk again with the IntelMQ team, because this is something related to the program and not the OS itself.

Once again, thank you!
There's a server subforum here. I think that's what was being referred to.
 
Old 06-01-2017, 11:01 AM   #9
mf370
LQ Newbie
 
Registered: Jun 2017
Posts: 5

Original Poster
Rep: Reputation: Disabled
Yes, it does work from the shell.

Quote:
There's a server subforum here. I think that's what was being referred to.
Alright I'll take a look on that subforum, thank you!
 
Old 06-01-2017, 11:28 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,850

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
so it works from shell. That means it is an issue with this sudoers, not with the application. /etc/sudoers itself cannot raise any json error.
 
1 members found this post helpful.
  


Reply



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
How to make a normal user execute commands of the super user's .?.. siranjeevi Linux - Server 1 07-03-2010 03:51 AM
apache user to execute privileged commands... s2cuts Linux - Server 2 02-20-2008 12:35 AM
cannot execute some commands as an plain user! minike Slackware 5 09-03-2004 06:34 PM
how can execute some commands when a user logs out rddreamz Programming 2 05-25-2004 03:00 PM
Can't execute commands when logged in as ordinary user.... murphaph Linux - General 3 04-05-2004 05:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 07:45 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