Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

244
Visualizações
RHEL8 selinux not allowing service to start from systemctl while tomcat/bin/startup.sh denied permission

i am using aws rhel 8 linux instance with tomcat folder mounted from EFS in AWS and using user ec2-user with full permissions on nfs mount data (tomcat folder) able to create delete files on /opt/mytomcat. (directory)

when i try to start directly from bin /opt/mytomcat/tomcat/bin/startup.sh working fine but when i try to run from /etc/systemd/system/tomcat.service it didnt worked i am sure my settings are correct , if i disable my selinux tomcat.service works fine.

Error :sudo systemctl start tomcat.service

tomcat.service: Failed to execute command: Permission denied Dec 14 10:58:02 ip-xxxxxxxx-2.compute.internal systemd[8827]: `

tomcat.service: Failed at step EXEC spawning

` `/opt/mytomcat/bin/startup.sh: Permission denied`

/opt/mytocmat/tomcat/startup.sh has context system_u:object_r:nfs_t:s0, should be system_u:object_r:usr_t:s0

when run audit2allow to find more details its show below to enabl nfs_t file

sudo audit2allow -a

#============= init_t ==============

allow init_t nfs_t:file { execute open read };

based on above i have tried to change permission on my nfs(efs aws drive) drive

[Tuesday 16:48] Rajesh Dandamudi sudo semanage fcontext -a -t init_t "/opt/mytomcat(/.*)?"

sudo restorecon -R -v /opt/mytomcat/

above command runs but nothing changes when check its still shows same its still same

system_u:object_r:nfs_t:s0. instead of init_t not sure how to fix it i am new selinux

my nfs drive mounting and working fine able to edit / update files without any issues

[ec2-user@ip-10-xxxxx ~]$ ls -lZ /opt/mytomcat
total 2273208
drwxr-x---. 2 ec2-user ec2-user system_u:object_r:**nfs_t**:s0       6144 Dec 10 18:11 audit
-rw-r-----. 1 ec2-user ec2-user system_u:object_r:nfs_t:s0 7727677 Dec  9 21:58 mytomcat

can some please help me , as i am new to selinux security bits

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

A few things you could try doing are:

  1. Is the startup.sh file executable by the root user. (chmod +x startup.sh)
  2. Consider changing the owner or group of your tomcat files so that it is accessible by the service. (using chown)
  3. Check the tomcat service configuration and see if there are any issues in that.

In my experience these kinds of problems seem to have a very simple root cause that may have been overlooked.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda