Skip to main content

Questions tagged [setuid]

The tag has no usage guidance.

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

Can Apache 2.4 run setuid root CGI binaries?

Note that I'm not asking about suEXEC, because the binary must be setuid root, and suEXEC doesn't allow root to execute CGI programs. I need to carry out a one-time configuration during system ...
QF0's user avatar
  • 315
1 vote
1 answer
31 views

setuid root problem with sticky bit: curl can't write to a new/empty directory in /tmp [duplicate]

I'm carrying out a one-off configuration operation which requires a remote client to communicate with a remote server. The client runs Apache, which runs a configure binary, which fetches various ...
QF0's user avatar
  • 315
0 votes
0 answers
25 views

Program not running with permission of the owner even though SUID is set [duplicate]

I have a program ./prog that is owned by root and has the SUID bit set. Permission: -rwsr-sr-x 1 root Then I check the EUID by geteuid() but when I run this (as a user), the output EUID is still my ...
Calliastrophile's user avatar
1 vote
1 answer
132 views

Permission denied when opening a file in gdb

I'm implementing some CTF challenges. The flags are in some text files, that get read from the programs. To protect the flags I have changed the owner of the files, but have set the setuid to the ...
r3k0j's user avatar
  • 15
0 votes
0 answers
57 views

How to grant setuid permission to sudo

So, I'm building my own Linux distribution and I've set up quite a lot, including sudo. Working from a shroot environment, sudo works well, the problem is when i actually boot into my distro. ...
Juancarlos Kai Shiro's user avatar
0 votes
1 answer
51 views

Can't the user which is executing the program access the not permissible files if the SETUID is set? [duplicate]

I have two users first being ace and the second being ej ace has a file in its home directory, which is a shell script, with the following permission set ( setuid i have used ) -rwsr--r-x 1 ace ace 15 ...
Yanjan. Kaf.'s user avatar
1 vote
1 answer
78 views

How to make the script, configured via sendmail aliases file, run as the user to whom that email is addressed?

I have a FreeBSD box running sendmail 8.16. I have several system users (test robots): robot1, robot2 and robot3 and I would like them to be controlled by emails. First of all they should be able to ...
Igor G's user avatar
  • 133
0 votes
2 answers
195 views

How to make command `id` print different real and effective UID in Ubuntu

The info page of command id states that it will output the effective user ID if different from the real user ID. I have been trying to achieve that somehow, running the command with the Bash shell as ...
gambarimas87's user avatar
3 votes
1 answer
542 views

effective vs real user ID : why doesn't it return root as effective ID in my example?

I did some reading about the difference between real and effective user ID. I thought I understood, but I have a doubt : according to my comprehension, in the example below the command $ id -un should ...
ChennyStar's user avatar
  • 1,795
1 vote
0 answers
33 views

Why does setreuid have this limitation on setting ruid to current value of suid?

According to the docs for setreuid: Unprivileged processes may only set the effective user ID to the real user ID, the effective user ID, or the saved set-user-ID. Unprivileged users may only set ...
quixotrykd's user avatar
0 votes
0 answers
93 views

SETUID not executing the script as owner when executed via PHP script

I have a sh file (with setuid) that I want specific web users to be able to execute from an endpoint: -rwsr-xr-x 1 root root 59 Sep 11 09:47 restart-workers.sh The content of this file is ...
Jaquarh's user avatar
  • 101
0 votes
0 answers
90 views

ACL implementation using setuid

I am working on an assignment that mainly deals with the following topic: The main idea is to run a program as fakeroot that elevates the privileges of one user to read the file of the owner. If ...
lamdeb's user avatar
  • 1
1 vote
1 answer
372 views

Why does adding a user and setting an SUID for it throws me the "Operation not permitted" error?

I am setting SUID for a new user tommy to run the same commands as root but it goes down like this: [root@192 ~]# useradd tommy [root@192 ~]# su - tommy [tommy@192 ~]$ chmod u+s /usr/bin/ls chmod: ...
Navdeep Singh's user avatar
-3 votes
2 answers
462 views

What is the effect of the "s" permission bit on a file?

I have two files with the following permissions: -rwsr--r-- 1 root root 213 Oct 22 12:15 f1 -r--rwxr-- 1 Bob staff 113 Oct 22 12:18 f4 Can the user Bob execute f1 and why? What is the effect of the ...
user543663's user avatar
1 vote
1 answer
249 views

SETUID not effective when calling cat from AWK script from C program

Consider the following simplified example which illustrates my problem. The server's OS is Debian 11 armhf. we're in directory /botm/test/: drwx------ 2 b b 4096 Sep 27 19:27 hide -rwsr-xr-x 1 b b ...
bicyclesonthemoon's user avatar
0 votes
0 answers
151 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,929
2 votes
1 answer
70 views

Is it impossible to run mount(1) from a setuid program?

I have a setuid program which, among other things, needs to remount a normally-readonly disk so it can write to it. That is, the program wants to run the command mount -o remount,rw / But the mount ...
Steve Summit's user avatar
-1 votes
1 answer
490 views

passwd source code

I am trying to look at the source code of the passwd and gpasswd programs. These tools check the effective UID set to zero to complete execution successfully. But I am a noob to C and couldn't find ...
Tomas 's user avatar
  • 141
10 votes
2 answers
1k views

Source of passwd error messages

I am testing if the passwd command could run if the setuid bit is disabled. I disabled the setuid by running the following command: chmod 0554 /bin/passwd After doing so, I tested if the passwd ...
Tomas 's user avatar
  • 141
1 vote
1 answer
977 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
0 votes
0 answers
327 views

debugger as a tool to get to root shell

according to the answer in the reference: Can gdb debug suid root programs? Claims that: "You can only debug a setuid or setgid program if the debugger is running as root. The kernel won't let ...
linuxbeginner's user avatar
2 votes
2 answers
802 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
452 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
  • 88
0 votes
1 answer
279 views

What are the effective permissions if a setuid program is executed via sudo?

I have read many questions and answers about how the setuid bit works and about how sudo works, and I think I have understood that stuff. However, I couldn't find out what should happen when a program ...
Binarus's user avatar
  • 3,430
0 votes
1 answer
379 views

Not able to assign root privilege to my process again by using setuid(0) in the same boot cycle

I have added the capability by using following cmd on terminal (alternative of setting CAP_SETUID in drop-in file). Verified that setuid/seteuid is working. setcap cap_sys_admin,cap_setuid+ep /...
Anshu Gangwar's user avatar
0 votes
1 answer
457 views

Why don't I find ping process in ps list?

Why can't I see the 'ping' process in my 'ps' listing when I started it as a regular user? The ping binary has setuid bit, ls -l /bin/ping -rwsr-xr-x 1 root root 64424 jun 28 2019 /bin/ping Running ...
ennc0d3's user avatar
0 votes
2 answers
836 views

How to explain all details with 'ls' command on freebsd and what color means?

I am trying to clone directory with cp command and meeting some attributes lost. For example, when I am trying to run sudo command from copied tree, it gives error. sudo: /usr/bin/sudo must be owned ...
Dims's user avatar
  • 3,285
0 votes
1 answer
78 views

Why is a find process getting started by checksecurity in Debian and how to disable it if it's not useful?

With sudo lsof | grep mounted-drive-name I found that a find process is running on one of my hard drives which I'd like to spare. With KDE's system monitor it shows me that it was started by anacron-&...
mYnDstrEAm's user avatar
  • 4,398
2 votes
2 answers
253 views

What does `ln /path/to/file -i` do in a setuid'ed script?

I was making a Bash script with the setuid permission on, but it didn't work. So I found my solution here: Why does setuid not work? and Allow setuid on shell scripts Now my script works fine and ...
Kristian's user avatar
  • 259
0 votes
0 answers
36 views

setuid not allowing me to run script as root? [duplicate]

I wrote this tiny script: #!/usr/bin/env -S bash -xeuo pipefail whoami cd /repo && git fetch origin master && git merge -s recursive -X theirs origin/master And set the u+s bit which ...
mpen's user avatar
  • 913
0 votes
0 answers
26 views

setuid doesn't work in /tmp [duplicate]

I wrote a C program, expecting to see the difference between uid and euid with setuid bit enabled: #include <unistd.h> #include <stdio.h> int main(void) { printf("euid: %d\n"...
z.h.'s user avatar
  • 1,004
1 vote
1 answer
799 views

Allow file read only through application

I have a file with a secret and a generator application that reads it and generates something similar to a license. There are users on that Linux machine who are allow to use that application. Because ...
hudac's user avatar
  • 779
6 votes
1 answer
8k views

Why ping works without capability and setuid [duplicate]

I learned from here that there's 2 ways to control privileged activities: setuid and capability. But when I'm playing around with ping on my machine, it seems that it can bypass these 2 mechanism. ...
zingdle's user avatar
  • 185
0 votes
1 answer
743 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
1 answer
4k views

what is utempter, and why does xterm want to use it?

when I start xterm, it tries to start a binary: /usr/lib/x86_64-linux-gnu/utempter/utempter I could not find any info as to what this binary is for. man utempter has no entry, and searching the web ...
Martin Vegter's user avatar
0 votes
1 answer
133 views

How can I tell if a SRPM package will have components which will run as root?

Some packages install software which needs to run with root privileges, such as the sudo package. Others, such as vim, do not inherently need to run with root privileges. Is there a generic way to ...
the_endian's user avatar
1 vote
0 answers
98 views

setuid not working as expected in Pop!_OS

So I was trying to experiment with setuid. As per my understanding it allows users to run the binary with context of the owner. So I wrote a program in C which does write operation in /root directory ...
mr_pool_404's user avatar
20 votes
2 answers
5k views

How does ping work on Fedora without setuid and capabilities?

As far as I know, ping needs to create a raw socket (which needs either root access or cap_net_raw capabilities). From my understanding the trend these last years has been to remove setuid binaries ...
Antoine Catton's user avatar
0 votes
1 answer
1k views

script with suid set but not working! [duplicate]

I have a simple script that runs fine under an app ID (just touches a new file), which I am trying to get to call via my personal ID. Note the target file location is in an area that my personal ID ...
Steve237's user avatar
  • 103
-1 votes
2 answers
841 views

Which one is safer? sudo dnf update OR su - ; dnf update

Is it safer to do: $ sudo dnf update [enter user password] or $ su - [enter root password] # dnf update I always assumed they are the exact same thing, because sudo utilizes setuid-root, so the ...
0x5929's user avatar
  • 135
0 votes
1 answer
401 views

Common binaries with support for command execution, like `awk` and `vim`, not respecting setuid bit?

I'm hardening a Linux system and wanted to test (setuid-based) shell escapes using common binaries, like awk, vim, etc., supporting command executing. However, all binaries I've tested except sh and ...
Shuzheng's user avatar
  • 4,601
0 votes
1 answer
447 views

How do I make sure sudo is setuid in repackaged squashfs?

I'm trying to manipulate a squashfs file, containing a yocto build and an application payload, but everytime I do so, sudo fails to execute afterwards. root user is disabled, so I have no real ...
Clearer's user avatar
  • 101
0 votes
0 answers
164 views

How can a malicious seccomp filter cause an attempt to use `setuid(2)` to return 0, without actually making the system call?

I was reading the documentation on seccomp(2) on my Debian system, and stumbled upon the following sentence from the paragraph below: Such a malicious filter might, for example, cause an ...
Shuzheng's user avatar
  • 4,601
0 votes
0 answers
92 views

Can the process read the file? SetUID privilege collision

User A executes a setuid program owned by user B. the program wants to read a file in /etc/data, that is only readable by A and no one else. Can the program read the file? And then I have another ...
Marco's user avatar
  • 1
3 votes
1 answer
1k views

setuid not working [duplicate]

I was trying to learn how setuid works. So I made a dummy program which just prints the current user: #include<bits/stdc++.h> using namespace std; int main(){ cout << system("id -...
Anmol Singh Jaggi's user avatar
0 votes
1 answer
655 views

Normal user run Qt C++ program as root without sudo?

I am writing a robotics program in C++, using Qt for the GUI, where each thread needs access to hardware. The library which accesses the hardware is called pigpio, and it modifies /dev/mem, so it ...
madscientist's user avatar
8 votes
1 answer
2k views

Nano able to read on write-only access file

User has write-only permissions on a file, unable to cat or vi but is able to nano normally. How is this possible? I was wondering what happens if you only have write-access on a file and this was ...
ministic2001's user avatar
0 votes
1 answer
219 views

Why can't I setuid binaries like apt?

During all my education I've been taught that the setuid would allow anyone that has the execution privilege on a file to run it as the owner. However it seems that I'm not able to setuid a binary and ...
Plancton's user avatar
  • 707
6 votes
2 answers
4k views

Questions about the saved user ID

As far as I understood the different user IDs are as follows (from the perspective of a process): real user ID: the user ID that owns the process effective user ID: the user ID which determines what ...
Chris's user avatar
  • 185
4 votes
1 answer
3k views

Why doesn't setuid() work with non-root users?

I'm experiencing a weird behavior regarding setuid() and the setuid bit. It seems like the suid bit and setuid() do not work as expected. I am expecting for a binary with +s and owned by uid 1001 ...
Tobi Nary's user avatar
  • 151