0

I have a folder which I want to share with users of a group named frx. I had applied chmod g+s to the folder, but for some reason the SUID bit (for folders in the /home/frx directory) came out as S instead.

> pwd
/home/frx

> ls -al
drwxrws---+  14 ferc frx    4096 Dec 24 23:20 .
drwxr-xr-x    8 root root   4096 Dec  2 12:48 ..
... 
drwxrwS---+  20 pi   frx    4096 Dec 19 18:50 views

From what I read, s and S shouldn't be any different if a user is just opening a file. However, another user in the group frx is unable to view or access files in the views directory, even though there are read/write permissions for the group. (He could touch files in /home/frx without problem.) Why is this happening?

How do I change the SUID bit to s for a directory?

Old Geezer
  • 397
  • 8
  • 25

1 Answers1

1

To access files in a directory, the user must be granted execute permission on that directory.

S (uppercase s) indicates that the sticky bit is set for a group but execute bit - is not. And this is why another user from frx group cannot access any files in the views directory. You must set both group sticky and execute bits for this to work properly.

Tomek
  • 3,390
  • 1
  • 16
  • 10
  • This is new to me. Wonder under what scenarios would a directory require `rw` but not `x`? – Old Geezer Dec 27 '22 at 04:52
  • `r` alone allows directory listing. I am not sure if `w` alone would work (I can imagine it allows hardlinking to existing file). `x` alone allows opening a file in a directory if you know its exact name, `wx` would also allow creating a file. – Tomek Dec 27 '22 at 09:21
  • I had `rwS` for the group, and a group member couldn't see the directory listing. It was just ????????. Couldn't read a file. Couldn't overwrite a file either. – Old Geezer Dec 28 '22 at 14:30
  • Yes, it was just that. – Tomek Dec 29 '22 at 06:47