Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [setuid]

The tag has no usage guidance.

0
votes
0answers
12 views

File ownership preservation with setuid and setgid

I have a folder which have setuid and setgid set, like this: drwsrwsr-x 2 max testgrp 4096 mars 20 23:57 . I have also 2 users test1 and test2, members of testgrp group When I create a file with ...
0
votes
0answers
28 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
1answer
56 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
2answers
917 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
1answer
119 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
0answers
25 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
0answers
63 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 ...
4
votes
1answer
133 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
0answers
111 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
0answers
129 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
1answer
193 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) ...
5
votes
1answer
2k 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
9
votes
1answer
3k 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
2answers
2k 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
1answer
54 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....
1
vote
0answers
95 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
1answer
49 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 ...
1
vote
1answer
480 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
1answer
155 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
2answers
138 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
0answers
342 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
2answers
2k 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
1answer
182 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
1answer
508 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 ...
2
votes
0answers
679 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
1answer
220 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?
27
votes
2answers
60k 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
3answers
130 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 ...
3
votes
1answer
765 views

What's to stop somebody from creating a setuid-root script 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 script 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 ...
9
votes
7answers
27k 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
1answer
4k 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
2answers
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 ...
141
votes
8answers
71k 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 ...