Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

238
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!