Linked Questions
72 questions linked to/from Allow setuid on shell scripts
31
votes
1
answer
43k
views
Why does setuid not work? [duplicate]
I want to ensure that my program can only be run by user xyz using root privilege. To do this, I set the setuid bit with:
chmod u+s program1.sh
ls -l program1.sh
rwsr-x--- 1 root house 1299 May 15 23:...
5
votes
1
answer
4k
views
How to let a user execute a script owned by root? Setuid doesn't seem to work anymore [duplicate]
I have some bash scripts that I use with the user 'root' to manage iptable rules.
The problem is that I want these things at the same time:
The script must be owned by root
Permissions must be 700
I ...
3
votes
1
answer
4k
views
suid script not working correctly [duplicate]
My os is Fedora 24 and I tried to test the suid bit functionality.
I wrote below bash as Setuid.bash:
#!/bin/bash
if [ $USER = 'root' ]
then
echo "Like Root Run"
echo "Root User Add in " $(...
1
vote
1
answer
5k
views
How to run privileged bash script as non-root? [duplicate]
I created a simple bash script which contains the command ifconfig. In general I want to execute such a privileged script to run as non-root user. I have tried hown root:users ./path/to/script.sh ...
0
votes
2
answers
1k
views
Why is the suid bit having no effect on a shell or perl script? [duplicate]
As an experiment in playing with the suid bit, I tried writing a script to run apt-get update from a bash script, and then set the suid bit on it, so I could just run ~/update or something.
apt-get ...
1
vote
1
answer
1k
views
How to use the "setuid" bit? [duplicate]
I created a small script as the root user...
#!/bin/bash
cat /etc/shadow
and set the setuid bit and placed it within the guest folder. When I ran the script as guest, it showed permission denied. ...
0
votes
1
answer
813
views
Is a php file with SGID bit and read-only & execute a security problem? [duplicate]
I find php files with SGID bit and read-only & execute. The group is root. Is this a problem?
Because a user will need to run the php interpreter with their our account, could it led to privilege ...
0
votes
0
answers
744
views
Effective and real user id matching? [duplicate]
I have the following script:
$ ls -al setprog.sh
-rwsrwxr-x 1 root root 52 Αυγ 2 10:23 setprog.sh
$ cat setprog.sh
#!/bin/bash
while [ True ]
do
echo $(whoami)
done
When running it
$ ./...
1
vote
1
answer
513
views
Why won't this example of setUID work? [duplicate]
I am learning about setuid and setgid where the user executing the script will inherit the owner's permission while running the script. To test this,
I created a bash as user fiverr in /home/fiverr/...
0
votes
0
answers
204
views
Always run script as root [duplicate]
I want to run a command automatically. The problem is that it may only be run after I logged in and that it requires superuser privileges. I've heard of suid before, so I thought I'd use it for this.
...
0
votes
1
answer
79
views
Can't the user which is executing the program access the not permissible files if the SETUID is set? [duplicate]
I have two users first being ace and the second being ej
ace has a file in its home directory, which is a shell script, with the following permission set ( setuid i have used )
-rwsr--r-x 1 ace ace 15 ...
2
votes
0
answers
63
views
Cannot execute file with root priviledges using SUID [duplicate]
So from what I understand, SUID makes so that when you execute a file, you're basically executing it under root, right? Now I made this file, and whenever I try to run it, I get a permission denied ...
3
votes
0
answers
30
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
...
252
votes
15
answers
559k
views
How to run a specific program as root without a password prompt?
I need to run something as sudo without a password, so I used visudo and added this to my sudoers file:
MYUSERNAME ALL = NOPASSWD: /path/to/my/program
Then I tried it out:
$ sudo /path/to/my/program
...
89
votes
9
answers
96k
views
Can a script be executable but not readable?
Is it possible to execute a script if there is no permission to read it? In root mode, I made a script and I want the other user to execute this script but not read it. I did chmod to forbid read and ...