trouble writing a setuid script
- From: Peter Michaux <petermichaux@xxxxxxxxx>
- Date: Sat, 30 Aug 2008 00:07:29 -0700 (PDT)
Hi,
I'm trying to write a setuid script and can't make it happen. I've
trimmed it down to the very simple example below trying to have a
logger.pl script add a message to a log file. This is my Bash
transcript with all the pertinent details.
$ ls -Al
total 8
-rw-r--r-- 1 root wheel 0 29 Aug 23:52 log
-rwsr-xr-x 1 root wheel 145 29 Aug 23:52 logger.pl*
$ cat log
$ cat logger.pl
#!/usr/bin/perl -w
use strict;
use warnings;
my $FILE;
open(FILE, ">> log") or die "couldn't open: ";
print(FILE "hello, world");
close(FILE);
$ whoami
peter
$ ./logger.pl
couldn't open: at ./logger.pl line 7.
$ sudo ./logger.pl
Password:
$ cat log
hello, world
So the script works when I "sudo" but not when the script runs as my
normal "peter" user.
Any ideas why it doesn't work and what I need to change?
(I don't run into any errors when writing the same program in C.)
Thanks,
Peter
.
- Follow-Ups:
- Re: trouble writing a setuid script
- From: magloca
- Re: trouble writing a setuid script
- Prev by Date: FAQ 7.30 What does "bad interpreter" mean?
- Next by Date: Re: trouble writing a setuid script
- Previous by thread: FAQ 7.30 What does "bad interpreter" mean?
- Next by thread: Re: trouble writing a setuid script
- Index(es):
Relevant Pages
|