-2

I am getting this error when trying to modify the SELinux label on a pre-commit hook. My first try was

chcon -t httpd_exec_t pre-commit 

Then I tried by adding the full context to the command

chcon -u unconfined_u -r object_r -t httpd_exec_t pre-commit 

But got the same error. Checking the labels I figured out that it doesn't have the SELinux label at all. The ls -Z command returns the following

-rwxr-x--x apache apache ? pre-commit 

Notice the ? symbol it should look something like this

-rwxr-x--x apache apache unconfined_u:object_r:httpd_exec_t:s0 pre-commit

I think that the error makes sense since the file does't have the SELinux label for some reason, the question is why and how to solve this.

I tried to restore the default SELinux context with the "restorecon -R -v /hooks" command but it doesn't work as expected.

Ricardo Alfaro
  • 110
  • 1
  • 10

1 Answers1

0

try this:

chcon -R -h unconfined_u:object_r:httpd_exec_t:s0 pre-commit
pezy
  • 1,022
  • 2
  • 8
  • 27