Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

setgid(2) [redhat man page]

SETGID(2)						     Linux Programmer's Manual							 SETGID(2)

NAME
setgid - set group identity SYNOPSIS
#include <sys/types.h> #include <unistd.h> int setgid(gid_t gid); DESCRIPTION
setgid sets the effective group ID of the current process. If the caller is the superuser, the real and saved group ID's are also set. Under Linux, setgid is implemented like the POSIX version with the _POSIX_SAVED_IDS feature. This allows a setgid program that is not suid root to drop all of its group privileges, do some un-privileged work, and then re-engage the original effective group ID in a secure man- ner. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EPERM The user is not the super-user (does not have the CAP_SETGID capability), and gid does not match the effective group ID or saved set-group-ID of the calling process. CONFORMING TO
SVr4, SVID. SEE ALSO
getgid(2), setregid(2), setegid(2) Linux 2.5 2002-03-09 SETGID(2)

Check Out this Related Man Page

SETGID(2)						     Linux Programmer's Manual							 SETGID(2)

NAME
setgid - set group identity SYNOPSIS
#include <sys/types.h> #include <unistd.h> int setgid(gid_t gid); DESCRIPTION
setgid() sets the effective group ID of the calling process. If the caller is the superuser, the real GID and saved set-group-ID are also set. Under Linux, setgid() is implemented like the POSIX version with the _POSIX_SAVED_IDS feature. This allows a set-group-ID program that is not set-user-ID-root to drop all of its group privileges, do some un-privileged work, and then reengage the original effective group ID in a secure manner. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EPERM The calling process is not privileged (does not have the CAP_SETGID capability), and gid does not match the real group ID or saved set-group-ID of the calling process. CONFORMING TO
SVr4, POSIX.1-2001. SEE ALSO
getgid(2), setegid(2), setregid(2), capabilities(7), credentials(7) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2009-10-17 SETGID(2)
Man Page

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using setuid and setgid

Hi, I have been looking at setuid and setgid. I understand that setuid determines who owns the file and setgid determines which group of people can access the file... yeah?! But i need to know how to actually use setuid and setgid. I'm guessing chmod will feature somewhere.. Any help... (1 Reply)
Discussion started by: crispy
1 Replies

2. Programming

setgid

I have a setuid to root program that has now to be changed to setuid to oracle depending on who is running it. Oracle has only two groups, dba (primary) and osgrp1 (secondary). But running 'id' if oracle shows all the secondary groups belonging to root, and only dba or osgrp1 as the primary group... (2 Replies)
Discussion started by: blowtorch
2 Replies

3. Shell Programming and Scripting

Searching for SETUID and SETGID using PERL file find with lstat

About System and Perl: Sun Solaris 5.9 sparc, Perl 5.6.1 I've decided to use the perl file::find module to look for all the SETUID and SETGID files on my unix boxes. I wrote something like this: (I've shorted it a little to make it simple) #!/opt/perl/bin/perl use File::Find; find... (1 Reply)
Discussion started by: x96riley3
1 Replies

4. Solaris

about setuid setgid permissions

hi.. why we go for setuid, setgid permissions? as a system admin ,when we use this ,except default solaris setuid,setgid files and dirs.. hopes that anyone can help me regarding this.. (1 Reply)
Discussion started by: saravananpalani
1 Replies

5. UNIX for Dummies Questions & Answers

A little doubt regarding setgid and Unix access right flags.

Hi all! I have a folder with permissions 2770 (SETGID) drwxrws--- 2 loguser admins 5 Mar 17 11:11 mydir Inside that folder there are some files with permissions 0640: -rw-r----- 1 loguser admins 0 Mar 17 11:11 monday.log -rw-r----- 1 loguser admins ... (2 Replies)
Discussion started by: verdepollo
2 Replies

6. UNIX for Dummies Questions & Answers

How can I re-enable the setuid or setgid bits ???

While I was looking for tips for hardening the security of my MAC OSX I found the following posting: "<How to disable Setuid and Setgid Binaries > Setuid programs run with the privileges of the file's owner (which is often root), no matter which user executes them. Bugs in these programs... (6 Replies)
Discussion started by: Vera
6 Replies

7. Solaris

Special File Permissions Setgid and setuid ..HELP

I have a user AAA who's who is part of a group call clserv and techsupp, His userfiles have the following permissions:- drwxrwx--- 16 AAA clserv 1858 Aug 22 12:48 UserFiles he has a link in his UserFiles/ lrwxrwxrwx 1 root root 36 Mar 9 2013 TECHSUPP_GLOBAL... (5 Replies)
Discussion started by: kilobyter
5 Replies

8. Programming

Permission error while using execve..

Hi, I have the following scenario.. 1) I have a binary which i launch from command line. It executes fine. 2) But when I launch it from another file using execve command, it gives a message that it is not able to access a shared object ".so" in /usr/bin (message is "Permission... (4 Replies)
Discussion started by: sathish1000
4 Replies

9. Shell Programming and Scripting

Setuid and setgid and similar settings

so im writing a script for a android system. these types of systems are not the typical unix systems. what i need to do is basic. i have a script which I put in a directory and then zipped up the directory in a zip file. that way, when the script is unzipped, the person unzipping will see... (1 Reply)
Discussion started by: SkySmart
1 Replies