Questions tagged [setuid]
The setuid tag has no usage guidance.
41
questions
1
vote
0
answers
36
views
What steps are needed to safely create a unix setuid binary that can mount removable drives without privilege escalation
The steps I can think of for a setuid binary that is willing to mount drives on arbitrary paths specified by normal users:
the binary must check whether /sys/block/DEV/removable=1
the binary must ...
0
votes
1
answer
634
views
Why aren't owner permissions applied when executing a script with suid set?
I have a bash file that I want to run with owner permissions when executed by a group user. So I set the file permissions with:
sudo -u owner_user chmod 4750 bash_script
The file then has the ...
0
votes
2
answers
3k
views
What is the meaning of using EUID?If RUID and EUID of a process is 1000, 0 and if we run any command the command is run as 1000 priviledge level,why?
As per my understanding,
RUID: uid of the caller of the process is called real uid.
EUID: effective uid means allowed privilege for that process.
// setuid_file.c
#include<stdio.h>
int main(...
2
votes
1
answer
537
views
Why "effective UID" of the process is not changing to the file's owner UID?
I have Ubuntu 20.04 virtual server.
I have an executable file script.sh in /opt that has SetUID bit set.
meliwex@linode:/opt$ ls -ld /opt
drwxr-xr-x 2 root root 4096 Dec 19 03:45 /opt
meliwex@linode:/...
0
votes
0
answers
113
views
proper way of using setuid permission in linux [duplicate]
I created two file , one abc.sh and another myfile . The content of abc.sh is :
#!/bin/bash
echo "hi" >> myfile
The current permission and owner for both file is:
abc.sh : rwsrw-r-x ...
2
votes
2
answers
607
views
Sending kill signal using a setuid process results in Operation not permitted
I want to be able to send a SIGHUP signal to a Prometheus process from a CI tool that runs with a different user than Prometheus. Let's say CI uses gitlab-runner user and Prometheus uses prometheus ...
0
votes
1
answer
454
views
CentOS 8 auditd AVC denials message flood caused by denied setuid
Today my CentOS 8 suddenly frozen and not responding to user inputs.
When I tried to login from console, I saw messages like these:
audit: backlog limit exceeded
audit: backlog limit exceeded
audit: ...
0
votes
1
answer
80
views
Modify a file via a script with special rights
Probably this is elementary.. Yet I didn't find an explanation to what's happening..
I have these files with these specific rights:
So modtp2 is a shell script I'm using to change tp2 content with a ...
6
votes
2
answers
17k
views
"user" CIFS mounts not supported - fedora 30
I have a number of smb v1 shares. (I know that smbv1 is old and vulnerable but I can't change it)
Because of the old smb protocol, I cannot use nautilus to open then. Instead, I used fstab entries to ...
0
votes
0
answers
105
views
scp to an authorized folder whose parent is forbidden for me, fails
I try to scp to a folder which is not mine. Its rights are set to 777 but the scp tells me Permission Denied.
When setting its parent folder's rights, whis still is not mine, to 777, then the scp ...
1
vote
1
answer
1k
views
Abuse suid program
I have some questions about setuid binary.
I know it exists some dangerous program (if you permit to use this program with sudo, it is possible to escape from the program and get a root shell) like ...
1
vote
2
answers
5k
views
Setuid and setgid not working
I'm having a problem with setuid and setgid. I've written this C code:
int main() {
setuid(0);
setgid(0);
system("/path/to/script.sh");
return 0;
}
Compiled it using gcc:
gcc test.c ...
0
votes
1
answer
1k
views
How to `create a setuid copy` of some command?
I am reading the book How Linux Works and there is something I do not understand:
On normal Linux systems, most processes have the same effective user
ID and real user ID. By default, ps and ...
1
vote
0
answers
106
views
setgid bit not preserved across execl call
I have a situation I can't explain:
I have an executable with setgid bit on. When I call getegid() it returns me the expected group. But once I spawn a shell from it using execl the shell no longer ...
1
vote
0
answers
104
views
setuid bit has different behavior depending on the directory
I've been testing the setuid permission, and I am having some trouble to making it work.
Let's say I am doing the tests with two user owneruser and otheruser.
I've written a simple c program that ...
3
votes
1
answer
2k
views
How to set permissions on directory, that will bequeath its permissions to all subdirectories?
Is there a way to set permissions on a *nix directory, so that when a subdirectory is created, the subdirectory will be created with all the permissions as the parent directory?
There's the following,...
3
votes
0
answers
236
views
iptables, groups and setgid
I have a question about the "owner" module of iptables. I saw that it's possible with it to only allow some programs to use services based on their (e?)gid.
On this basis, I can employ the set-group-...
0
votes
0
answers
212
views
setuid not working on a script [duplicate]
I'm working on a RHEL 6.7 machine. I'd like to make a script which is owned by root BUT could be launched by other users. However I still want the actions inside the script to be launched as root. So ...
0
votes
1
answer
524
views
dont allow user to kill program started as another user using setuid bit
i have a binary with below permissions.
-rwsr-xr-x. 1 root root
so when some user X tries to execute the binary, its runs as root. Moreover, the user is able to kill this process(running as root) ...
6
votes
1
answer
4k
views
Why strace sudo command bombs when sudo command works?
my username is allowed to execute
sudo command
then why does this bomb
strace sudo command
with the error:
sudo: must be setuid root
11
votes
1
answer
6k
views
Why does ping require the setuid bit?
In the Jessie version for the Raspberry Pi, ping requires the setuid bit to be set. What is the rationale for this?
3
votes
2
answers
4k
views
Android / linux ignores setuid flag
I am trying to get root access to my chinese x86 tablet. With adb I have root. I copied a "sh" binary and set setuid bit, and from adb it works as expected:
1|shell@x98air3g_c5j8:/ $ which su.sh
/...
0
votes
1
answer
92
views
How can I wrap a sensible text file with a Bash script that allows every user to grep for $USER?
So I have a file data.txt that stores user name and some piece of data, one line per user. I'd like to have a Bash script that is runable by the users and allows them to call
grep -w "^$USER" data....
0
votes
0
answers
339
views
Setuid bit for root is set but real user id is not 0
My program permissiontest has the following privileges:
-rwsrwxrwx 1 root root 8664 Nov 18 15:59 permissiontest
It consists of the following code when being run as non-root user:
#include <stdio....
0
votes
1
answer
118
views
Group of a user when running a setuid executable
If a user, user1 belongs to group1 and also a setuid executable exists that is owned by user1 and group, group2. user1 is not a member of group2.
I am seeing that the executable cannot access files ...
2
votes
1
answer
1k
views
Prompting for sudo password in a setuid root binary
I have a setuid root binary, with_sudo.bin, with the following source code:
/* with_sudo.c */
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
...
0
votes
1
answer
182
views
Linux setuid programs/files
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 ...
0
votes
2
answers
306
views
followup: why are shebang files not suid-able?
followup question to https://unix.stackexchange.com/questions/364/allow-setuid-on-shell-scripts . there is a very good answer by Gilles. alas, I do not understand it. nothing described there seems ...
1
vote
0
answers
555
views
Strange behaviour for setuid and setgid
I am doing a small experiment with special privilege bits as follows:
[root@localhost~]# useradd user1
[root@localhost~]# cp /bin/touch /home/
[root@localhost~]# chown user1:user1 /home/touch
[root@...
0
votes
2
answers
3k
views
Why my setting with NFS and setuid not working in Linux
I'm using Linux. On machine A I have such NFS setting in etc/exports:
/home 10.0.129.130(rw,no_root_squash)
I mount this directory on machine A on /home/nfs/ on machine B. And I've set setuid using ...
0
votes
1
answer
327
views
Setuid command seems to not working
I had windows application installed on Linux Mint computer, for example, in Demo directory. And in Demo folder, I have files directories structure as follow
-rwxrwxrwx spuser spuser aaa.dll
-...
1
vote
1
answer
589
views
Developing and deploying application that will run as root using setuid?
I have an application that needs to run with root permissions.
Using setuid bit on the application file seems like a logical choice. My understanding of setuid is that the files should be owned by ...
3
votes
0
answers
893
views
How to run php script (via web server) as different user under Mac OS X
I'm trying to call an executable from a PHP script that needs to be run as a different user (NOT root) than the web server normally runs as. I thought it should be sufficient to just set the setuid ...
1
vote
1
answer
394
views
Is it possible to upload setuid-set file to ftp-accessible directories?
Just curious, is it possible to upload files set with setuid permission to directories using ftp and retain its setuid permission?
Or does FTP always change the permission?
32
votes
4
answers
84k
views
Can I make a script always execute as root?
How to make a script execute as root, no matter who executes it?
I read about setuid but I'm not sure how to do this.
I'm using Linux, Ubuntu 12.04 LTS.
1
vote
3
answers
224
views
Do all my programs have owner rights to all my files?
I'm worried about all my programs having full access to all my files.
Eg: My user is 'john'. I install some program, say Dropbox. Dropbox runs as 'john'. Therefore it not only has full rights on its ...
4
votes
1
answer
2k
views
What's to stop somebody from creating a setuid-root binary on a flash drive, then putting it into another person's computer and getting root access?
What's to stop somebody from creating a setuid-root binary on a flash drive, then putting it into another person's computer and getting root access? I assume there's some kind of protection against ...
13
votes
7
answers
52k
views
How to run a program as root without "sudo"?
I have a certain binary program on OS X that can only be run as root.
I'm tired of prepending sudo each time I invoke it and typing the password, and would like it to automatically run as root when I ...
1
vote
1
answer
7k
views
Strange strace and setuid behaviour: permission denied under strace, but not running normally
This is related to this question.
I have a script (fix-permissions.sh) that fixes some file permissions:
#! /bin/bash
sudo chown -R person:group /path/
sudo chmod -R g+rw /path/
And a small c ...
1
vote
3
answers
1k
views
Allow user to execute a shell script without seeing its contents?
I'd like to have an hg hook that sends email using a gmail account. Obviously I don't want anyone to be able read the email-sending script except me or root, since it has a password in, so here's what ...
145
votes
9
answers
75k
views
Running upstart jobs as unprivileged users
What's the canonical way to have an upstart job change its userid and run the script as an unprivileged user?
Obviously one can use su or sudo, but this seems hacky (and can generate needless log ...