`setuid` is a file permission flag under Unix-like systems that will run an executable with the file owner's permissions rather than the invoking user's. On some systems (FreeBSD), it further works identically to the related `setgid` flag on directories, causing new files to inherit the directory's permissions rather than the current user's.
Questions tagged [setuid]
254 questions
2
votes
1 answer
Is it possible to keep setgid bit for unzipping files by non root user?
I have a folder with the following permissions:
drwxrws--x+ 13 myuser www-data 4096 Mar 20 09:57 project-folder
In this folder I have an archive archive.zip with the following permissions:
-rw-rw----+ 1 myuser www-data 10260 Mar 20 09:56…

koninka
- 53
- 6
2
votes
1 answer
Why do files in /proc/self end up being owned by root if a program has its setuid bit set?
I have this small program:
#define _GNU_SOURCE
#include
#include
#include
extern char **environ;
int main()
{
char * const arglist[] = { "/bin/ls", "-l", "/proc/self/maps", NULL };
uid_t uid, euid, suid;
…

Omnifarious
- 54,333
- 19
- 131
- 194
2
votes
0 answers
How to use setuid bin to access another executable?
I have a C program which gets its name, tacks the string ".script" to the end, and executes the resulting script. My goal is to have the C executable have the setuid bit set, and for the script to be owned by the effective uid. But when I test it,…

Robert Nix
- 69
- 1
- 7
2
votes
1 answer
Run docker container via a setuid binary
I am trying to set up a container on my (debian stretch) server, and to lock it down as much as possible.
The container my-container only needs to be started, it then does some processing and returns (the whole thing takes about one second).
I can…

MayeulC
- 1,628
- 17
- 24
2
votes
2 answers
Is this possible to switch the user and group of an application thread?
I want to build a small web application in Rust which should be able to read and write files on a users behalf. The user should authenticate with their UNIX credentials and then be able to read / write only the files they have access to.
My first…

lschuermann
- 862
- 1
- 7
- 17
2
votes
1 answer
sgid bit security
I work in a shared web development environment. My team frequently creates new files and folders on the server, but they always need to change group permissions afterward.
For default permissions on new files, I set umask 002 in the bashrc. BUT for…
user496650
2
votes
1 answer
setuid() returns 0 but has no effect
I have the following code:
#include
#include
#include
void main(int argc, char* argv[]) {
printf("uid=%u euid=%u\n", getuid(), geteuid());
printf("%d = setuid(euid)\n", setuid(geteuid()));
printf("uid=%u…

Valentin Lorentz
- 9,556
- 6
- 47
- 69
2
votes
1 answer
How to scan for SUID files in root using Java and access its properties?
I'm a newbie to UNIX systems.
I'm being tasked with finding a SUID file in the root directory and access its file properties to get some things done.
Is there anyway I can write a Java based application to search for files with Sticky bit and access…

Mahesh De Silva
- 505
- 8
- 20
2
votes
1 answer
Automated testing of privileged operations
How do you unit/integration test code that requires a different privilege level than exists in your continuous integration environment?
In my non-root, CCRB-driven build environment, I've got some utility functions that assume privileges that don't…

pilcrow
- 56,591
- 13
- 94
- 135
2
votes
2 answers
Pipe access privileges for setuid program
I am extending some software (of which I am not the author) that runs under GNU / Linux (Ubuntu 14.04) and consists of a manager process and several worker processes. The manager can start a worker by means of a command line that I can specify in a…

Giorgio
- 5,023
- 6
- 41
- 71
2
votes
2 answers
Is getresuid deprecated in c99?
I'm trying to compile a function containing a call to getresuid. However it generates the following warning:
setuid.c:8:3: warning: implicit declaration of function 'getresuid' is invalid
in C99 [-Wimplicit-function-declaration]
getresuid(&ruid,…

lingz
- 321
- 3
- 14
2
votes
1 answer
Passwordless SSH using cgi-perl script
This is my first shot at trying out cgi-perl scripts. I have SSH keys set up between my (root user) local machine and a remote machine. I'm trying to run a command on the remote box and display the output on a webpage hosted from my local machine.…

AV.
- 21
- 2
2
votes
1 answer
Get calling user ID in PHP setuid script
I have a PHP script on Linux in which the sticky bit is set, so it gets executed as the file owner. How can I get the user id of the calling process, for authorization purposes?
Context: I have two applications on a server, and want one to request…

Bart van Heukelom
- 43,244
- 59
- 186
- 301
2
votes
1 answer
Linux, the only way to GAIN root access is executing a setuid-root file?
Is my assumption true, that on Unix/Linux, the only way to GAIN root access is to execute a setuid-root file?
In other words, the system calls setuid(), setgid() are all about DROPPING privileges?
Please note that my question is not about exploits.

SzG
- 12,333
- 4
- 28
- 41
2
votes
3 answers
set-UID bit not working as intended
I'm running a raspberry pi and would like to create an executable which simply should reboot it after some seconds. (I plan on triggering it via ssh and log out before the actual reboot takes place)
I created an executable with c++ with the…

ben
- 5,671
- 4
- 27
- 55