Tomcat installed folder access is denied on linux

Please find below set of cmds & outputs [[email protected] opt]$ ls -al total 9416 drwxr-xr-x 3 root root 4096 Nov 7 13:52 . dr-xr-xr-x 25 root root 4096 Nov 7 13:16 .. -rw-r--r-- 1 root root 9625824 Sep 4 22:52 apache-tomcat-8.5.34.tar.gz drwxr-xr-x 5 root root 4096 Aug 11 01:26 aws [[email protected] opt]$ sudo groupadd tomcatgrp

[[email protected] opt]$ sudo useradd -s /bin/false -g tomcatgrp -d /opt/tomcatfolder tomcatuser

[[email protected] opt]$ ls -al total 9420 drwxr-xr-x 4 root root 4096 Nov 7 13:53 . dr-xr-xr-x 25 root root 4096 Nov 7 13:16 .. -rw-r--r-- 1 root root 9625824 Sep 4 22:52 apache-tomcat-8.5.34.tar.gz drwxr-xr-x 5 root root 4096 Aug 11 01:26 aws

drwx------ 2 tomcatuser tomcatgrp 4096 Nov 7 13:53 tomcatfolder

Now, when I run the cmd I am getting Permission denied as follows

[[email protected] opt]$ cd /opt/tomcatfolder/

-bash: cd: /opt/tomcatfolder/: Permission denied

Can you please help in resolving this above issue..?

I followed instructions of installing Tomcat from this link how-to-install-apache-tomcat-8-on-centos-7

728x90

1 Answers Tomcat installed folder access is denied on linux

It seems you are the ec2-user, but the directory is owned by tomcatuser and the permissions on the directory do now allow other users or groups to read it.

Try sudo chmod 755 /opt/tomcatfolder/ and then cd into it.

That will add read and execute permissions to the directory.

4 months ago