`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
0
votes
1 answer
/bin/sh does not drop privileges
Hello stackoverflow guys,
I have written a C program that simply invokes a bash shell using system("/bin/bash")
If i enable the setuid permission bit and execute the program, the invoked shell does not have euid set to 0. This is ok, because we know…

user1506450
- 11
- 1
- 3
0
votes
1 answer
Setting UID to User Other Than Root in C++
I am developing in C++ on NetBeans 6.9 on Ubuntu 11.04. I am making a system() call which I would like to be called as user "peter" rather than as root. I understand that
setuid(0);
sets the user to root but how does one set the user to…

OtagoHarbour
- 3,969
- 6
- 43
- 81
0
votes
1 answer
setreuid call fails to re-establish process permissions
I am a bit confused with setreuid.
Scenario: A process runs as normal user (id: cateof) but for a very short fraction of time needs to be run as root. I have to elevate permissions to root from cateof and then back to normal user. My first thought…

cateof
- 6,608
- 25
- 79
- 153
-1
votes
1 answer
Why the setuid program does not have the privilege to execute system()
I have the following program:
$ cat cat.c
#include
#include
#include
int main(int argc, char *argv[])
{
char buf[32];
if(argc == 1) {
errx(1, "please specify an argument.");
}
sprintf(buf, "cat %s",…

xiaogw
- 653
- 8
- 18
-1
votes
1 answer
Binary create a shell as another user
I have a specific question,
I have a binary that launch a shell with execv but the shell change the user and with gdb i can't seem to find where the user change is happening.
level0@RainFall:~$ whoami
level0
level0@RainFall:~$ ls -la
-rwsr-x---+ 1…

Sjorinn
- 3
- 1
-1
votes
1 answer
Chef client run root.sh for NMO setuid status
I need to run root.sh as root user and then restart the OEM agent as user "xxxxx". Which involves changing permissions of some folders and files and setting the SETUID bit along with permission changes.
And this will resolve an error called "NMO…

Nam
- 1
- 1
-1
votes
1 answer
unable to run script with owners privileges even after setuid bit is set and o+rx is provided
unable to run script with owners privileges even after setuid bit is set and o+rx is provided
Hi,
I have created a script with user Shyam and provided r-x to other and set the setuid bit for this file.
-rwsrwxr-x. 1 shyam shyam 53 Nov 26 14:43…

Arjun
- 1
- 3
-1
votes
1 answer
Why should a set-uid program never create a file that is owned by the program owner and that is writable by other users?
From The Linux Programming Interface
If a set-user-ID-root program must create a file that initially it must own, but
which will eventually be owned by another user, the file should be created so
that it is initially not writable by other…

Tim
- 1
- 141
- 372
- 590
-1
votes
1 answer
Set owner of the new created file in C
I have a program write.c, which creates a new file. I compiled that through root user and set the sticky bit for setuid using chmod u+s write.
Now, if a user2 executes this program. A new file is created with the root as owner, why ? The owner of…

tarun14110
- 940
- 5
- 26
- 57
-1
votes
2 answers
Executing a Python command with a setuid/setgid wrapper
I have the following Python script that I'd like to execute with the permissions afforded by the setuid/setgid bit:
#!/usr/bin/env python3
from mypackage.cli import main as cli_main
cli_main()
However: I would like execute the command directly from…

DanielGibbs
- 9,910
- 11
- 76
- 121
-1
votes
1 answer
Segmentation Fault in this C wrapper
I am new to C and this is a simple wrapper(rootsetuidwrapper.c) written to execute scripts as a different user. The script I want to execute is ubuntu-server-secure.sh at path (/home/neehar) as root. My operating system is Ubuntu 12.04.03 LTS. Can…

CodingWolf
- 3
- 4
-2
votes
2 answers
find files which have been modified in the last 30 minutes in Linux
how to find files based upon time information, such as creation, modified and accessed. It is useful to find files before a certain time, after a certain time and between two times. what command in Linux would i have to use ?
I understand to find…

sumr
- 25
- 3
- 11
-3
votes
1 answer
Execute the script owned by root from C++ code
I am trying to run a script from my c++ code owned by root.
But it throws me an error permission denied to run the script.
Permissions on files are as follows:
-rwx------ 1 root mygame 39 Dec 24 19:11 script.sh
-rwsr-xr-x 1 gag5kor mygame 7999…

Daemon
- 1,575
- 1
- 17
- 37
-4
votes
2 answers
Switch to Linux root account in executing C++ binary with password, POSSIBLE?
I am trying to copy some files to a root user from a user with very low (almost no privileges). I need to allow someone with access to the low account copy some files onto the higher account. I have thought about using a bin/Bash script, but I don't…

Jay Ma
- 65
- 9