Score:0

Unable to open a file with Read group permission

tl flag

I am trying to grant users read-only access to directory (conf) contents, so I added a user(dev1) to a group (tomcat) and set the group permission to g+r. I have the following user:group

1) tomcat:tomcat
2) dev1:developers

I have the following file and directory permissions:

dev1@athena:~$ ls -la /opt
drwxr-xr-x  6 root     root     4096 May 26 11:24 .
drwxr-xr-x 19 root     root     4096 May 20 15:09 ..
drwxr-xr-x  9 tomcat   tomcat   4096 May 26 10:34 apache-tomcat-10.1.9
lrwxrwxrwx  1 tomcat   tomcat     25 May 26 11:24 tomcat -> /opt/apache-tomcat-10.1.9

dev1@athena:~$ ls -la /opt/tomcat/ 
drwxr-xr-x 9 tomcat tomcat  4096 May 26 10:34 . 
drwxr-xr-x 6 root   root    4096 May 26 11:24 .. 
drwxr----- 3 tomcat tomcat  4096 May 26 16:02 conf
    
dev1@athena:~$ sudo ls -la /opt/tomcat/conf 
drwxr----- 3 tomcat tomcat 4096 May 26 16:02 . 
drwxr-xr-x 9 tomcat tomcat   4096 May 26 10:34 ..
-rw-r----- 1 tomcat tomcat   1411 May  9 14:30 context.xml
-rw-r----- 1 tomcat tomcat   6985 May 26 10:57 server.xml
-rw-r----- 1 tomcat tomcat 172391 May  9 14:30 web.xml

Note: I deleted some ls entries for brevity.

I configured dev1 to be a member of the tomcat group and verified, like so:

dev1@athena:~$ sudo usermod -aG tomcat dev1
dev1@athena:~$ groups
developers sudo tomcat
dev1@athena:~$ id
uid=1002(dev1) gid=1002(developers) groups=1002(developers),27(sudo),1001(tomcat)

I have logged out and login as dev1 and even restarted the VM. However, when I try to open server.xml using vi, I get a Permission Denied error

dev1@athena:~$ vi /opt/tomcat/conf/server.xml
  ...
  "/opt/tomcat/conf/server.xml" [Permission Denied] 

When I try to list the contents of /opt/tomcat/conf, I also get Permission Denied error.

ls -la /opt/tomcat/conf
ls: cannot open directory '/opt/tomcat/conf': Permission denied

What permission did I miss to allow dev1 read-only access to the contents of /opt/tomcat/conf directory? Have I misunderstood Linux file permissions?

Additional info:

Version: Ubuntu Live Server 22.04.2
VM: VMWare Fusion 13.0.0
OS: Macos (M1) Monterey

Any help will be greatly appreciated. Thanks in advance.

hr flag
See [Accessing files in a directory without x-permission?](https://askubuntu.com/questions/83788/accessing-files-in-a-directory-without-x-permission)
waltinator avatar
it flag
Explore your Mount/Read/Write/Execute problems with `https://github.com/waltinator/pathlld`, a `bash` script to show the permissions, mount options along the path to an object or objects.
Dominique Morales avatar
tl flag
@steeldriver Thanks for the link. I added g+x permission to make it work.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.