So I am trying to demonstrate to myself the workings of setting SGID bit. SUID demonstation was simple enough. Run passwd, switch to another terminal and run
Code: Select all
[sdg@centy ~]$ ps -eo euser,egroup,ruser,rgroup,command|grep passwd
root sdg sdg sdg passwd
First, I looked for files with SGID bit set and came up with ssh-agent as being one I might could demonstrate with.
Code: Select all
---x--s--x. 1 root nobody 382232 Oct 19 16:52 /usr/bin/ssh-agent
I figured there could be any number of thing happening behind the scenes which I didn't understand so maybe I could try a different approach. I copied the sleep utility into my homedir owned by root:root, and set the SGID.
Code: Select all
[sdg@centy ~]$ ls -l ./sleep
-rwxr-Sr-x. 1 root root 33112 Feb 13 07:59 ./sleep
[sdg@centy ~]$ ./sleep 300
[sdg@centy ~]$ ps -eo euser,egroup,command|grep ./sleep
sdg sdg ./sleep 300
sdg sdg grep --color=auto ./sleep
[sdg@centy ~]$
Thanks,
SDG