Questions tagged [setgid]

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
21 views

Set group and mod of a new directory

I try to set for NEW created files/directories in /home/test: group to "test" right to "770" This works for the group (1). chown :test /home/test chmod g+s /home/test But I do ...
chris01's user avatar
  • 585
0 votes
1 answer
110 views

Inherit ownership and permissions to directories and files

I have a directory test with the owner user:group and 770 as permissions. I want, that every directory and file within test do have the same specifications. I tried chmod g+s,u+s test, which partially ...
Timo Treichel's user avatar
1 vote
1 answer
230 views

podman running as user dies after hard reboot - Method gave invalid 400 URI Failure message: Failed to setgroups - setgroups (22: Invalid argument)

I'm struggling to determine what is going on here. Podman running in user space was running fine, but the server took a hard reboot and now it is... for lack of a more accurate technical assessment, ...
Grant Curell's user avatar
3 votes
2 answers
211 views

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/ ...
enoopreuse22's user avatar
1 vote
2 answers
150 views

SUID bit ignored when creating files / directories

I've set the SUID & SGID bit on a folder belonging to user foo with sudo chmod g+s myfolder & sudo chmod u+s myfolder drwsr-sr-x 24 foo www-data 4,0K Okt 25 16:17 myfolder Then I went inside ...
Black's user avatar
  • 2,079
0 votes
1 answer
123 views

Shared directory with setgid not working as expected

I have a group of developers who want to share the same directory. I created a new group with these developers and created a directory for them. On that directory, I set the group to the group I ...
John Passaniti's user avatar
0 votes
0 answers
146 views

I have an Apache2 CGI executable trying to use setgid()/setuid(). But it fails switching to root. How do I fix that issue?

My CGI executable starts as expected. At some point, though, it tries to become root (and then yet a different user). At that point, the CGI fails. Here is the pertinent code snippet: [...] int const ...
Alexis Wilke's user avatar
  • 2,877
1 vote
1 answer
877 views

Is appropriate to use setuid() over setresuid()/setreuid()/seteuid()?

I have an executable binary which was compiled from a C source file The executable has the setuid permission on I noticed that, if the owner of the executable is root, I can use setuid(geteuid()); ...
rafagarci's user avatar
2 votes
2 answers
706 views

Why I can't set the setuid for "others"?

I can't set other's setuid bit. Why? Is there some security lock? $ ls -l -rwxrwxr-x 1 allexj allexj 16784 Mar 11 17:30 a....
Allexj's user avatar
  • 265
2 votes
1 answer
420 views

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 ...
Iyán's user avatar
  • 78
2 votes
0 answers
284 views

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 ...
Philippe Ombredanne's user avatar
1 vote
3 answers
1k views

rsync not setting stickybit / GID bit

Using the following rsync command, the RWX permissions are being correctly set for both files and directories but the sticky bit options are not. rsync -rtvz --partial-dir=.rsync-partial --chmod=Da+t,...
ezekiel's user avatar
  • 167
0 votes
1 answer
711 views

How to access/set other user's environment variables after setregid() and setreuid() in C

I have a privileged C program that is executed by a standard user (say stduser) and on execution switches to a system user (say sysuser) as follows. Basically, I am trying to do something similar to ...
Anirban's user avatar
  • 141
2 votes
0 answers
172 views

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....
Wesley De Keirsmaeker's user avatar
0 votes
1 answer
976 views

stickybits setgid not working

I have structure like: /home/reed/, user=reed, group=reed - apache-conf, user=reed, group=reed - apache-web, user=reed, group=apache, perm=0770 - www.website.com, user=reed, group=apache, ...
Reed's user avatar
  • 141
0 votes
1 answer
720 views

How to set different file and directory default permissions with or without ACL within a shared directory with `setgid` and `sticky bit` set?

I have searched over on multiple SE sites, though there doesn't seem to be an answer to this question. Using setgid bit, it allows to retain parent group and sticky bit for ownership, though this ...
Darkfish's user avatar
  • 101
1 vote
1 answer
81 views

Setgid strange behavior

I have following files: ----rw---- 1 wojtek users 4 Oct 26 15:56 data.txt -rwx--s--x 1 wojtek users 8864 Oct 26 16:00 fopen_setgid When I run fopen_setgid as daro then everything works as ...
Spectre911's user avatar
0 votes
1 answer
86 views

How to remove a setgid directory that links to another location?

I use an environment variable $DATAPATH that conveniently takes me to where I store my data. Idk what I did just now but I created a folder in my home directory called '$DATAPATH', and when I cd into ...
jjiang's user avatar
  • 101
1 vote
0 answers
324 views

Applying special permission suid & sgid

I was in the processs of learning a bit about the special permission in Linux. Where is find certain anomilies. suid - For executable/files where user subsume the UID/permission of the owner. With ...
Shashwat's user avatar
  • 111
4 votes
1 answer
3k views

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 ...
derobert's user avatar
  • 110k
4 votes
2 answers
2k views

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 -...
user avatar
1 vote
2 answers
3k views

Can't set group ID bit on directory

I have created a directory called newDir and changed the group it belongs to with mkdir newDir && chgrp test-group newDir. I was user me when I did this. Calling stat newDir produces ...
Matthias Braun's user avatar
2 votes
2 answers
4k views

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-...
alex.forencich's user avatar
1 vote
1 answer
2k views

Linux open() syscall and folder permissions

I have a process P which is spawned by a process owned by root. After P is created setguid() and setuid() are called and it runs as user U. The process P attempts to create a file f on a folder F (in ...
Bemipefe's user avatar
  • 165
8 votes
2 answers
3k views

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'...
Scott Colby's user avatar
1 vote
0 answers
430 views

SETUID and SETGID Behavior

The setup: ~$ ls -l /etc/sudoers -r--r----- 1 root root 614 2017-09-10 20:29 /etc/sudoers ~$ ls -l /etc/shadow -rw-r----- 1 root shadow 794 2011-04-18 11:49 /etc/shadow $ ls -l $(which ht) -rwsr-sr-...
rootshellz's user avatar
1 vote
2 answers
881 views

How to call chmod and preserve the SGID bit?

I have the following directory structure: + public/ |-+ pics/ | |-- a | `-- b `-+ thumbs/ |-- a `-- b I would like all the files in the tree to be owned by gallery:http with ug=rwX,o= mode set. ...
David's user avatar
  • 268
0 votes
2 answers
1k views

How to set setgid bit for a program to allow it change its group folder?

The preconditions are somewhat complex, so here is the context: There is a program, that is launched through a shell script; The shell script launches the program through a .jar file; I want this ...
The Dreams Wind's user avatar
4 votes
2 answers
2k views

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 ...
sshekhar1980's user avatar
1 vote
1 answer
49 views

Do I need to set uid bit in this case?

I have modified xlockmore source to add a feature I needed, but it is unable to read the shadow password file and is asking me to set uid or gid bit on the binary. But the official binary I use doesn'...
saga's user avatar
  • 1,401
3 votes
2 answers
3k views

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 ...
user53029's user avatar
  • 2,833
0 votes
0 answers
952 views

scp file to remote server prevent delete

A team want to implement a crude file dump backup solution to be used by multiple hosts. They have a remote user on the backup server backupusr that they can SSH/SCP with, with SSH keys setup. The ...
batfastad's user avatar
  • 1,035
2 votes
1 answer
1k views

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 ...
Rich's user avatar
  • 205
89 votes
5 answers
256k views

'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 ...
otus's user avatar
  • 991
2 votes
2 answers
3k views

Why the S_ISUID and S_ISGID mode bits got cleared when the owner or group of an executable file are changed by an unprivileged user

I was reading the man page of chown. I don't understand why S_ISUID and S_ISGID mode should be cleared when the function returns successfully.
NYoung's user avatar
  • 123
6 votes
2 answers
2k views

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? ...
Ask and Learn's user avatar
1 vote
0 answers
183 views

Limit program execution to a list of arguments

I would like that my Unix users can only run a specific command insecurecommand with a controlled list of arguments stored in a file. The only solution I have found at this time is to : Create a new ...
Prunkdump's user avatar
13 votes
2 answers
6k views

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 ...
goldilocks's user avatar
  • 87.8k
3 votes
1 answer
561 views

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 ...
jthill's user avatar
  • 2,720