Skip to main content

Questions tagged [suid]

Use [suid] only for the suid/nosuid option of mount. Use the more general [setuid] for questions about the setuid/setgid mechanism in Unix.

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

SUID not running as file owner [duplicate]

I'm trying to check how the SUID works, and I have created a binary with the shc compiler from this script: #!/bin/bash echo "I'm the script" sleep 5 cat /srv/test/secret The binary is ...
franlol's user avatar
0 votes
2 answers
90 views

Easiest way to safely get the equivalent of SUID on a shell script

I have a script in which I need to mount an overlay to give an OCI container access to a mounted read-only directory /nix/store as if it was writable. I would like to have this script be runnable by ...
Mathias Sven's user avatar
0 votes
1 answer
101 views

how to allow running a suid exe only with restricted params/env/context?

I have a suid-to-root executable that users should run only with certain parameters, env var settings and context setup. I can't modify that exe. I will wrap the exe in arg-less scripts, one for each ...
schmeg's user avatar
  • 21
1 vote
1 answer
369 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
1 vote
2 answers
157 views

SUID bit ignored when creating files / directories

I've set the SUID & SGID bit on a folder belonging to user foo with sudo chmod g+s myfolder & sudo chmod u+s myfolder drwsr-sr-x 24 foo www-data 4,0K Okt 25 16:17 myfolder Then I went inside ...
Black's user avatar
  • 2,098
-2 votes
2 answers
794 views

What is the difference between SUID file permission and ACL?

What is the difference between SUID and ACL file permission? Also, when should I use either?
Dassy Areg's user avatar
0 votes
1 answer
30 views

Escalated predefined ssh scripts to remote computer implemetation

The problem is that I want to run certain ssh commands (Or scripts) from computerA to computerB without using a password. Examples: ssh apple@computerB 'poweroff' ssh apple@computerB "killall ...
Saft's user avatar
  • 36
0 votes
1 answer
780 views

How can I verify that a file is being execute as root account?

Let's say we have created a file with root account with -rwsr-xr-x script.sh permissions. We have set suid bit on this file so any user who is gonna execute this file, it's gonna be execute by owner ...
Mohammad's user avatar
0 votes
1 answer
156 views

Any reason for specifying -type f in find when looking for files with SUID bit set?

What's the reason for using -type f with find / -perm -u=s -type f 2>/dev/null. I see this all over the Internet and don't understand why to specify the type as regular file if look for SUID bit ...
user211245's user avatar
0 votes
1 answer
400 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,571
0 votes
0 answers
58 views

Run a script as root with SUID [duplicate]

I created a simple script on Ubuntu Server 18.04: #!/bin/bash apt update apt upgrade then I changed the owner to root # chown root update.sh then I added SUID bit and execution bits for user and ...
Sasan's user avatar
  • 143
1 vote
1 answer
351 views

does nosuid work on bind-mounts to suid partitions?

if i have /target mounted with suid and then make a bind-mount on /bound with mount -o bind,nosuid /target /bound, will nosuid take effect on /bound ? (imo it should take effect but i'd still like a ...
hanshenrik's user avatar
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
3 votes
0 answers
28 views

How to create a directory behalf on root user? [duplicate]

I have a script: [postgres@LaHarch ~]$ cat mkrundir.sh #!/bin/bash mkdir /run/postresql With attributes: [postgres@LaHarch ~]$ ll mkrundir.sh -rwsr-sr-x 1 root root 74 Aug 26 18:53 mkrundir.sh ...
Артем Максимов's user avatar
3 votes
2 answers
855 views

What does it mean for a folder to have suid permission? [duplicate]

I know what it means for a file to have suid permission. It means when other users have execute permission for it, they execute as the owner of the file. But what does it imply when a folder has suid ...
Just a learner's user avatar
1 vote
0 answers
35 views

Need to run scripts/commands with root privileges for user selfservices

The core of the topic is a very a common but I am not satisfied. I have a script looking for a pid and running the kill command on the pid if found. So I chown the script to root.root and add 4755 ...
Jan S's user avatar
  • 57
0 votes
1 answer
57 views

How to Run the command or script through any user in linux? [closed]

I am having a C executable in AIX system by which I can run the command through any user like root or system users. script having below permissions. On AIX server lrwsrwxrwx 1 root system 24 ...
user3548033's user avatar
2 votes
1 answer
680 views

Alternatives to suid, for script and interpreted languages

On Unixes (including Gnu/Linux) suid/sgid (or file capabilities) is the only, native (all other ways use this way), way to escalate privileges. As a sysadmin, I like to write scripts as they are ...
ctrl-alt-delor's user avatar