9

I'm setting up Nagios core on CentOS with SELINUX=enforcing.

I try to run

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/

as suggested in the manual, but I get this error messages:

chcon: can't apply partial context to unlabeled file `cmd.cgi'
chcon: can't apply partial context to unlabeled file `trends.cgi'
chcon: can't apply partial context to unlabeled file `histogram.cgi'
chcon: can't apply partial context to unlabeled file `avail.cgi'
chcon: can't apply partial context to unlabeled file `history.cgi'
chcon: can't apply partial context to unlabeled file `status.cgi'
chcon: can't apply partial context to unlabeled file `tac.cgi'
chcon: can't apply partial context to unlabeled file `showlog.cgi'
chcon: can't apply partial context to unlabeled file `notifications.cgi'
chcon: can't apply partial context to unlabeled file `extinfo.cgi'
chcon: can't apply partial context to unlabeled file `statuswml.cgi'
chcon: can't apply partial context to unlabeled file `outages.cgi'
chcon: can't apply partial context to unlabeled file `statuswrl.cgi'
chcon: can't apply partial context to unlabeled file `statusmap.cgi'
chcon: can't apply partial context to unlabeled file `config.cgi'
chcon: can't apply partial context to unlabeled file `summary.cgi'

Any ideas how to avoid these errors?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Mohammed Shannaq
  • 191
  • 1
  • 1
  • 4

2 Answers2

5

You need to relabel the files with the right selinux type:

semanage fcontext -a -s system_u -t httpd_sys_script_exec_t /usr/local/nagios/sbin/*
Michael Mrozek
  • 91,316
  • 38
  • 238
  • 232
Sergei Lomakov
  • 478
  • 1
  • 3
  • 7
1

10 years ago! Can you solve the problem? I also faced the same problem and read almost all the contents of the internet. My OS is Ubuntu. When I typed the command ls -lZ, I realized that none of my files and directories have labels! So, according to Sergi Lomarkov answer, I installed semanage and with the command semange fcontext, I wanted to create a label on the directory. But I encountered the following error parsing semanage configuration file: syntax error /n ValueError: Could not create semanage handle. And I did not find any solution for it.

miladmrm
  • 11
  • 2
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://unix.stackexchange.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://unix.stackexchange.com/help/whats-reputation), you can also [add a bounty](https://unix.stackexchange.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/417431) – AdminBee Jul 05 '22 at 09:08