Questions tagged [setuid]

`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.

254 questions
0
votes
0 answers

SUID bit in linux, not working as it should

I have a text file called Demo, which have write permission for the owner only. I also have an executable file (here called demowr.bash) that will write to this Demo file, and because I want other users to use this program, I set the set-uid…
Arjob Mukherjee
  • 387
  • 1
  • 10
0
votes
1 answer

Executing Jobs as other user

Usually executing Jobs as other user we can do sudo -u . However in case of forever process we have to do this way: exec su -s /bin/sh -c 'exec "$0" "$@"' username -- /path/to/command [parameters...] Ref:…
user 923227
  • 2,528
  • 4
  • 27
  • 46
0
votes
1 answer

setuid program doesn't work on 2.6 kernel

I am having trouble understanding why my setuid program doesn't seem like it is actually elevating permissions, even though the id's seem correct. This is running on a 2.6 kernel and fails, but works exactly as intended on Ubuntu 14.04 doing the…
0
votes
0 answers

setuid and sqlite can't open database

I have a fairly simple c++ program that needs to manage a local "cache" in a secure way. My idea was to make the executable setuid-root and store the cache in root's home dir. I enter setuid mode by calling seteuid(0). I then chroot to root's home…
7 Reeds
  • 2,419
  • 3
  • 32
  • 64
0
votes
0 answers

Is there a way to add the setuid bit to a mac application bundle?

I want to make a separate version of TextEdit owned by root with setuid so I didn't always have to use nano and other terminal-based text editors to edit config files and the like. Is there an easier way to do this other than just invoking their…
Morgan H
  • 70
  • 1
  • 10
0
votes
1 answer

File Permission flag 'setuid' is being ignored

I wrote this script, basically what it does is to drop the ram caches. I know it's messy - all the "echo '' that you see are just a work around to make it cleaner, I like some blank lines between the commands. #!/bin/bash free -m && wait echo '';…
0
votes
0 answers

How to fix Linux 'su' and 'sudo' file attributes?

linux, how to reset properties on the command files 'su' and 'sudo?' What is the exact command syntax, please? I unthinkingly changed the entire /bin and /usr/bin directories and contents to "user" and "group," instead of root and root. Plus they…
skypuppy
  • 1
  • 2
0
votes
1 answer

setuid not changing uid

I am working in Linux and trying to execute a C program with setuid on Linux. Here is my code: #include #include #include #include int main() { int ret; fprintf ( stderr, "Orig: %d Effective:…
unxnut
  • 8,509
  • 3
  • 27
  • 41
0
votes
1 answer

running a root only execute process with non root id

well i just wanted to understand the setuid mechanism.so i wrote a C program (prog1) that triggers a bash (i used system("/bin/sh") when executed & i set the setuid-bit for the executable (as root),So normally when its executed by another user,but…
afr0ck
  • 65
  • 6
0
votes
1 answer

Linux/Python How do I import a root access py module as a non-root user?

I'm trying to keep passwords that are usually written in a py file separated from the script and make it so that those passwords are only accessible by root and python whenever a script needs it. I got the idea reading…
pyramidface
  • 1,207
  • 2
  • 17
  • 39
0
votes
0 answers

chmod unable to set setuid in Solaris 11 with zone

I am using a Solaris cluster with shared storage. I have created a mount point in global-zone using shared storage [let it be /external/mnt] and then this mount point is further used in non global-zone. Following is an example which explains how…
amithreat
  • 51
  • 5
0
votes
2 answers

Setuid-bit and apt-get strange behavior

I have a strange behavior at my raspberry pi. I wrote a small C-Program to update the RPi. It just calls via system() "apt-get update && apt-get dist-upgrade && apt-get upgrade && rpi-update && reboot" With the setuid-bit the program will be…
Peter C. Glade
  • 543
  • 2
  • 8
  • 16
0
votes
1 answer

UnsatisfiedLinkError when running Jetty9's setUID feature

I just tried to run Jetty 9 as non root users, using setuid feature without success for binding low port numbers. I enabled the module setuid in the start.ini and added -Djava.library.path=/opt/jetty/lib/setuid But I have the following stack trace…
Vinicius Dantas
  • 165
  • 1
  • 10
0
votes
0 answers

Group permissions when running a program with the SETUID bit

I'm setting up a system where users can via SFTP upload png files which will be later copied to a directory accessible from the www server, one file after each few hours. The only thing left to do is to set up the permissions correctly and I failed…
botm
  • 1
  • 2
0
votes
0 answers

In python, os.setuid is done, but cannot os.system('touch myfile')

FYI: mydir/ userA:mygroup rwxrwxr-x mydir/test.py userA:mygroup rwxr-xr-x userB gid=xxx(mygroup) In test.py: uid = pwd.getpwnam('mysql')[2] os.setuid(uid) os.system('id') os.system('touch myfile') Log in as userA, execute: >…
ShenLei
  • 567
  • 1
  • 5
  • 17