setgid is a bit that can be set in the filesystem. If an executable is setgid, then when that executable is run, the spawned process will have an effective group id (EGID) of the group owning the executable, instead of the group of the user running it.
Questions tagged [setgid]
37 questions
88
votes
5 answers
'chmod g+s' command
Hello I want to understand the role of the chmod g+s command in Unix.
I also would like to know what it does in this particular context:
cd /home/canard;
touch un;
chgrp canard .;
chmod g+s .;
touch deux ;
I understand all the commands roles except…
otus
- 981
- 1
- 6
- 3
13
votes
2 answers
Group memberships and setuid/setgid processes
Processes which de-escalate privileges via setuid() and setgid() do not seem to inherit the group memberships of the uid/gid they set.
I have a server process that must be executed as root in order to open a privileged port; after that it…
goldilocks
- 86,451
- 30
- 200
- 258
8
votes
2 answers
Unset setgid bit with chmod numeric mode
I've just noticed some interesting behavior with chmod when unsetting the setgid bit:
$ mkdir test
$ chmod 2755 test
$ stat -c '%a %n' test
2755 test # as expected
$ chmod 0755 test
$ stat -c '%a %n' test
2755 test # what? see below
$ chmod 00755…
Scott Colby
- 283
- 2
- 10
6
votes
2 answers
Why ssh-agent group ownership is not root
Trying to understand why ssh-agent has sgid bit and found this post ssh-agent has sgid
I have another question, why the group ownership of ssh-agent is nobody not root? What is the reason behind it? Will it still work if group ownership is root?
Ask and Learn
- 1,865
- 4
- 25
- 34
4
votes
1 answer
Why is chmod g+s on a directory being ignored?
I have a git (actually git-annex) repository I'm trying to make shared, part of which involves setting the set-group-id bit on several directories. This is on a Debian GNU/Linux Stretch box, on an ext4 filesystem. For some odd reason, chmod g+s…
derobert
- 107,579
- 20
- 231
- 279
4
votes
2 answers
setgid: chmod g+s,g-x on executable
I'm not understanding setgid on executables on my platform (ubuntu). g-x,g+s is not giving the process effective group permissions of the program's owner.
$ gcc perms.c -o perms; ls -l ; ./perms
-rwxr-xr-x 1 ubuntu ubuntu 9302 Feb 24 01:00…
user211221
4
votes
2 answers
Meaning of setgid on an executable
I get that setuid on a binary executable allows the process to get the effective uid of the binary owner. What I cannot understand is what if setuid bit is off but setgid bit is on for a particular executable. What happens in this case?…
sshekhar1980
- 511
- 1
- 5
- 15
3
votes
1 answer
setgid binary doesn't have permission, mount's right, I'm missing something, but what, please?
I've checked the manpages, the mount, the permissions ...
(edit: combined history into one sequence as requested. Starting to seem a not-simple problem. Nothing new since last edit, just bundled up all pretty)
~/sandbox/6$ editfunc…
jthill
- 2,671
- 12
- 15
3
votes
2 answers
Why is /var/mail setgid?
I am learning about UNIX file permissions and I saw that on my Ubuntu system, /var/mail has the setgid bit set. Why is this?
$ ls /var/mail/ -dl
drwxrwsr-x 2 root mail 4096 Feb 23 05:57 /var/mail/
This book I'm reading says:
Setgid is useful when…
enoopreuse22
- 31
- 2
3
votes
2 answers
setgid sticky bit not working
I have yet another frustrating problem. I have a group of users belonging to the "testing" group. I have a folder located at /var/log/projects with the setgid bit set. This is so any new files or folders that get created in /projects will always…
user53029
- 2,725
- 8
- 40
- 65
2
votes
1 answer
Why "permission denied" when running `less` with chmod 6110?
Assume you are user x, so running id gives
uid=1001(x) gid=1001(x) groups=1001(x)
And there is also a user y with
uid=1002(y) gid=1002(y) groups=1002(y)
Now as root we create a file readme in user's x home directory like this:
# cd /home/x
# touch…
Iyán
- 68
- 5
2
votes
0 answers
Using umask vs. setgid: best practice for peacefully sharing a directory in a Linux users group?
What is the best way to share a directory between multiple Linux users?
Say I have a directory at /foo (a regular directory no NFS or else) and a bunch of users added to the group bar.
What I want is this behavior:
all users in bar can read/write…
Philippe Ombredanne
- 151
- 5
2
votes
0 answers
setgid being ignored by application
I run a Weblogic installation on a Oracle Linux Server 7.8. An application in weblogic will write some files to a local directory as output. The application uses the Oracle Weblogic FileAdapter for it.
Setup of the directoy, with…
Wesley De Keirsmaeker
- 121
- 3
2
votes
2 answers
Samba shared folder with setgid problem
I am setting up a file server with a shared directory. Inside, there are per-user folders that are readable by any user and a shared directory that is readable and writeable by any user. The per-user folders are simple enough. However, I am…
alex.forencich
- 675
- 1
- 8
- 12
2
votes
1 answer
Share files/directories by setgid
To allow write access to a specific group, shared files/folders can be made writeable by default for everyone in this group and the owning group can be automatically fixed to the group which owns the parent directory by setting the setgid bit on…
Rich
- 195
- 1
- 5