Questions tagged [suid]

16 questions
55
votes
8 answers

Run a shell script as a different user

What's a good way of running a shell script as a different user. I'm using Debian etch, and I know which user I want to impersonate. If I was doing it manually, I would do: su postgres ./backup_db.sh /tmp/test exit Since I want to automate the…
Wadih M.
  • 962
  • 1
  • 9
  • 17
15
votes
3 answers

Cannot Set UID on Shell Scripts

Can anyone help me find out what is going on here? I have some rules set up tracking packet counts. When I run the following script as root: #!/bin/bash iptables -t mangle -xnvL I get the output I expect: //snip 233203 199929802 MARK //blah blah…
Tom Ritter
  • 3,147
  • 5
  • 25
  • 30
5
votes
1 answer

How can I use SetUID on a shell script to run as a non-root user?

Our company's server is running Ubuntu 12.04 (Precise) and Apache 2. We have a custom, internal web application installed. I have a bash script which pulls any updates to that app from source control to the server. Only one user on the system (the…
Jazz
  • 153
  • 1
  • 4
4
votes
2 answers

Allowing nagios plugin check_dhcp to work without setuid root

Nagios has a plugin, check_dhcp, that does exactly what you'd think. It's widely suggested to install it setuid root, because it uses SO_BINDTODEVICE, which usually only root can do. Of course a similar thing can be accomplished with sudo as well,…
Phil Frost
  • 637
  • 5
  • 18
3
votes
3 answers

Problems with SUID

I have a simple command that I want to be able to perform as a user, but it requires root permissions. I suspect that this is a case for the "SUID"-bit, but I've never used it. This is what I've tried: aioobe@e6510:~/bin$ sudo -s root@e6510:~/bin#…
aioobe
  • 361
  • 1
  • 4
  • 15
2
votes
1 answer

Running a shell script with its owner's privileges

On a Debian (5.0.3) server I have a user svnsync who owns a certain shell script: -rwsrwsr-x 1 svnsync users 119 Dec 21 13:45 mirror-svn.sh I'd like everyone in the users group to be able to execute this script with svnsync's privileges. This is…
Jonik
  • 2,911
  • 4
  • 37
  • 48
1
vote
1 answer

Why /proc has nosuid on Ubuntu

I notice /proc and /dev is mounted differently on ubuntu than other linux distribution as follows: Ubuntu: udev on /dev type devtmpfs (rw,nosuid,relatime,size=4079136k,nr_inodes=1019784,mode=755) proc on /proc type proc…
Alex
  • 11
  • 2
1
vote
1 answer

Is runing script with SUID bit set up work the same as runing same script with sudo (or root)?

I wanna run some script with root priviliges but by apache user. So I added SUID bit to script file but this doesn't work as I expected. Script file owner is root. rwsr-xr-x 1 root root 2438 paź 8 12:10 script.sh When I run this from bash as…
B14D3
  • 5,110
  • 13
  • 58
  • 82
1
vote
3 answers

Running svnsync on a repository with group suid/sgid set fails to execute a hook

I have a Linux server that I am attempting to run svnsync against a list of repositories to mirror / back up. I created a folder /srv/backups and set it to have the group gsid of adm, using chmod g+s so that any item or folder created in this…
Damon
  • 131
  • 8
1
vote
1 answer

smbd won't start or stop when user is elevated to root by SUID bit

Under Ubuntu 12.04, I've written the following C program to help me shut down my server's apache2 and samba services while I run automated backups. Notice that in the Makefile I'm setting the SUID bit so that the program will have root privileges…
Isaac Sutherland
  • 767
  • 2
  • 9
  • 16
1
vote
4 answers

find / -perm -4000 -o -perm -2000 > suid.. help with bash script to run nightly.?

help me with this this problem. so far i have "find / -perm -4000 -o -perm -2000 | xargs ls -l > suild.list" argument that i want to write as a bash script. I would like to write this as a bash script and be be able to run this nightly everyday.…
su
0
votes
1 answer

Sticky bit enabled Script can't write to a root file

I have 2 files in the /tmp/. The first one is an empty file named "file" with permission -rw------- and owner root:root. The second file is named "script" which is a simple Ruby script with permission -rwsr-xr-x and owner root:root. The contents of…
S.Goswami
  • 277
  • 1
  • 3
  • 9
0
votes
5 answers

Setuid not working on Solaris

I have a Perl script marked setuid, but when I run it, it says I don't have permission to do so. I am running Solaris 10. This works on another system but I can't tell whats different. What am I doing wrong? $ ls -l total 16 -r-sr-x--- 1 root …
Eric Johnson
  • 303
  • 5
  • 12
0
votes
1 answer

How to SUID? Shellscript, Perlscript, Binary-Wrapper?

I just read some articales about suid. lets say i need the helpdesk to be able to change customer passwords. it would be good if i could execute a ruby script that checks the db if the user is a customer (i dont want the helpdesk to change roots…
baj
  • 139
  • 2
  • 8
0
votes
1 answer

PHP Security: Need help understanding SUID

I am reading a book about PHP Security and there's the below I do not really understand, specific part in bold. So say PHP want to move a file that belongs to user A, PHP has to run as user A? Is that allowed? I am not really a system admin but I…
Jiew Meng
  • 231
  • 4
  • 13
1
2