SETUID(3) Library Functions Manual SETUID(3)NAME
setuid, seteuid, setruid, setgid, setegid, setrgid - set user and group ID
SYNOPSIS
#include <sys/types.h>
setuid(uid)
seteuid(euid)
setruid(ruid)
uid_t uid, euid, ruid;
setgid(gid)
setegid(egid)
setrgid(rgid)
gid_t gid, egid, rgid;
DESCRIPTION
Setuid (setgid) sets both the real and effective user ID (group ID) of the current process to as specified.
Seteuid (setegid) sets the effective user ID (group ID) of the current process.
Setruid (setrgid) sets the real user ID (group ID) of the current process.
These calls are only permitted to the super-user or if the argument is the real or effective ID.
SEE ALSO setreuid(2), setregid(2), getuid(2), getgid(2)DIAGNOSTICS
Zero is returned if the user (group) ID is set; -1 is returned otherwise.
4.2 Berkeley Distribution May 12, 1986 SETUID(3)
Check Out this Related Man Page
setuid(3) Library Functions Manual setuid(3)Name
setuid, seteuid, setruid, setgid, setegid, setrgid - set user and group ID
Syntax
#include <sys/types.h>
#include <unistd.h>
setuid(uid)
uid_t uid;
seteuid(euid)
uid_t euid;
setruid(ruid)
uid_t ruid;
setgid(gid)
gid_t gid;
setegid(egid)
gid_t egid;
setrgid(rgid)
gid_t rgid;
Description
The subroutine sets both the real and effective user ID of the current process to the ID specified. Likewise, the subroutine sets the real
and effective group ID of the current process to the ID specified.
The subroutine sets the effective user ID of the current process, while the subroutine sets the effective group ID of the current process.
The subroutine sets the real user ID of the current process, while the subroutine sets the real group ID of the current process.
These calls are only permitted to the super-user or if the argument is the real or effective ID.
Environment
POSIX
SYSTEM_FIVE
When your program is compiled in POSIX or System V mode the following semantics apply when using the or functions:
If the process is the super-user the real, effective, and saved set (as described in user/group ID are set to uid.
If the process is not the super-user, but uid is equal to the real or the saved set user/group ID, the effective user/group ID is set to
uid. The real and saved set user/group ID remain unchanged.
POSIX
In POSIX mode, the function returns a value of type uid_t. The function returns a value of type gid_t.
Return Values
Zero is returned if the user ID or group ID is set; -1 is returned otherwise.
See Alsosetreuid(2), setregid(2), getuid(2), getgid(2)setuid(3)
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)
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)
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)
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)
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)
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)
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)
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)
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)