Re: suid question, kind of
>I tried this after reading the man page and it did not work, so I read the man
>page again and it seems that --user is intended for use in closing a process,
>not in starting one.
damn. You're right. Rename the script below, edit the vars at the top,
and you are i business. Sorry to have led you in the wrong direction before.
--cut kicker.pl
#!/usr/bin/perl
$pidfile = "/var/run/mypidfile";
$daemon = "/usr/bin/id";
#@options = ("-i", "-o", "-etc");
$user = "nobody";
die "I am already running ! \n"
if ( -e $pidfile);
system "echo $$ > $pidfile";
$< = $> = (getpwnam($user))[2]; #set uid and euid
exec $daemon, @options
or die "Error: can't exec : $! \n";
--cut
This will do the setuid part; all you have to do is use start-stop-daemon to
start/stop this script, which in trun will start/stop your program. You
can use the --pidfile option to start-stop-daemon, which is a Good Thing.
Carl
Reply to: