I have tomcat installed in /opt/tomcat and would like to get access to sub-folders for user 'mck'.

mck@hp15-pc:/opt/tomcat$ ls bin
ls: cannot open directory 'bin': Permission denied


here are the permissions for /opt/tomcat

drwxr-xr-x 9 tomcat tomcat 4.0K 2020-12-23 21:30:41 ./
drwxr-xr-x 4 root   root   4.0K 2020-12-23 21:25:41 ../
drwxr-x--- 2 tomcat tomcat 4.0K 2020-12-23 21:29:32 bin/
drwx------ 3 tomcat tomcat 4.0K 2020-12-23 21:43:09 conf/
drwxr-x--- 2 tomcat tomcat 4.0K 2020-12-23 21:29:32 lib/
drwxr-x--- 2 tomcat tomcat 4.0K 2020-12-23 21:35:40 logs/
drwxr-x--- 2 tomcat tomcat 4.0K 2020-12-23 21:50:10 temp/
drwxr-x--- 7 tomcat tomcat 4.0K 2020-12-03 06:45:57 webapps/
drwxr-x--- 3 tomcat tomcat 4.0K 2020-12-23 21:35:40 work/
-rw-r----- 1 tomcat tomcat  19K 2020-12-03 06:48:29 BUILDING.txt
-rw-r----- 1 tomcat tomcat 5.3K 2020-12-03 06:48:29 CONTRIBUTING.md
-rw-r----- 1 tomcat tomcat  56K 2020-12-03 06:48:29 LICENSE
-rw-r----- 1 tomcat tomcat 2.3K 2020-12-03 06:48:29 NOTICE
-rw-r----- 1 tomcat tomcat 3.2K 2020-12-03 06:48:29 README.md
-rw-r----- 1 tomcat tomcat 6.8K 2020-12-03 06:48:29 RELEASE-NOTES
-rw-r----- 1 tomcat tomcat  17K 2020-12-03 06:48:30 RUNNING.txt

I have added 'mck' user to 'tomcat' group here are the groups for 'mck'

mck@hp15-pc:/opt/tomcat$ groups mck
mck : mck tomcat

I noticed this strange output of 'id', I do not see the group 'tomcat' in the groups list if I omit the username.

mck@hp15-pc:~$ id
uid=1000(mck) gid=1000(mck) groups=1000(mck),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),114(lpadmin),134(sambashare)

mck@hp15-pc:~$ id mck
uid=1000(mck) gid=1000(mck) groups=1000(mck),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),114(lpadmin),134(sambashare),1002(tomcat)

I do not want to change the permissions or user and groups on the tomcat folder '/opt/tomcat'.

What do I need to do to allow access to sub-folders of /opt/tomcat for user 'mck'? Is it possible?

I logged out and logged in again but the problem is not resolved.


I first tried logout and re-login but it did not resolve the issue.

I had to restart the system for the issue to go away.

Also, now the "id" and "id mck" both show identical output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.