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
1 answer

Why the set-uid operation can't be used in an excutable file?

When learning the system security in the ubuntu 20.04 on the VMware, I tried the set-uid operation and found the fllowing question: With the excutable file catcall compiled by the source code…
0
votes
0 answers

sh: 1: : not found when trying to open a new shell

I am trying to get a shell but it either doesn't open one or it throws an error and gets stuck saying ^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B^[[B sh: 1: : not found Below is the .c code #include #include #include #include…
RRHS
  • 99
  • 1
  • 2
0
votes
0 answers

Problems with readlink and set uid

I'm having trouble getting setuid to work as hoped (chmod 3755). I'm trying to implement, using C language, my own version of psgrep (or pgrep) for a very specific need. In order to accomplish this, I need to get the value of the link at…
Dennis
  • 1,071
  • 2
  • 17
  • 38
0
votes
1 answer

What is PARANOIA meaning on chroot and setuid?

I know paranoia meaning but I'm reading isc-dhcp source code and I got confused about this term in system programming and linux world. configure.ac file has following codes : # PARANOIA is off by default (until we can test it with all…
alirezaarzehgar
  • 171
  • 1
  • 8
0
votes
0 answers

How can I using getrlimit to get normal user's nproc in c program

[root@api ~]# ulimit -u 3766 [zack@api ~]$ ulimit -u 5000 i cant fetch zack's nproc by using setuid(zackid) in program ,why? [root@api dbhome]# ./a zack UID:1000 EUID:1000 GID:1000 RLIMIT_NPROC cur:3766 // still root's nproc
zack
  • 1
0
votes
2 answers

setuid and setgid wotking with 0 (root) only, I want it to work other user

I'm trying to write a program that run /bin/bash with user smith privileges, smith:x:1000:1000:Basket:/home/smith:/bin/bash I tried this: #include #include #include int main () { setgid(1000); …
maksim lev
  • 11
  • 3
0
votes
1 answer

How to use setcap to enable setuid capability

I have the following c program. $ cat main.c #include #include #include int main(int argc, char *argv[]) { int fd; if((fd = open(argv[1], O_RDONLY)) == -1) { perror("open"); return 1; } …
0
votes
0 answers

Linux setuid bit

As a normal user I can't seem to run the following bash script: #/bin/bash date 121001102020 The file permissions are: 4755 The file owner is: root I would expect to be able to run this as a regular user. What I get is: date: cannot set date:…
Blake McBride
  • 394
  • 3
  • 16
0
votes
1 answer

Create Linux user to access folder with rwxrwS--- (2760) permissions

I have a folder that has permissions set to 2760. The folder seems to be owned by www-data user and group. drwxrwS--- 2 www-data www-data 196 Dec 5 19:52 folder I added new user to www-data group, but it still cant access the folder without…
Kalvin Klien
  • 911
  • 1
  • 12
  • 32
0
votes
1 answer

Why does SETUID not work on Raspberry Pi?

I am trying to create a shutdown command that can be run as a user, i.c., a flask web page that is not running as root. Sounds simple, just put a shutdown command in a SETUID script. Because SETUID does not work on shell scripts, I created an…
Roland
  • 4,619
  • 7
  • 49
  • 81
0
votes
2 answers

setuid: operation not supported

package main import ( "log" "syscall" ) func main() { setuidErr := syscall.Setuid(0) if setuidErr != nil { log.Fatal(setuidErr) } } When I run above code, I get the following…
Ren
  • 2,852
  • 2
  • 23
  • 45
0
votes
1 answer

Is it a sensible strategy to call setuid twice to clear the saved set-user ID?

For a program I'm developing, there's no reason why it should ever be run with setuid bit set - that always represents a configuration error on the part of the user. As part of defense in depth, I'd like to detect and fix that in the program. As I…
Arthur Tacca
  • 8,833
  • 2
  • 31
  • 49
0
votes
1 answer

Setuid for iphone app to run as root

Im am trying to make my iphone app run as root, and i was told to setuid, I do not know how to do this.
Heli0s
  • 119
  • 1
  • 1
  • 7
0
votes
3 answers

Using setuid in Ubuntu to exec Java from C

I am running Ubuntu 11.04. I am trying to use a "C" execlp program to run a Java program, and then I want to setuid on the "C" program so the Java program can execute as root. There is an example of this…
0
votes
1 answer

Security Concerns on SetUID for non-privileged, malicious process (Linux)

I understand that setUID bit works with the EUID and RUID in Linux to give non-provisioned users temporary root access to executables that require it. However, my main concern is that let's say a process is malicious on a computer. Even if the…
Justin Tjoa
  • 47
  • 1
  • 6