|Think about Loose Coupling|
Running Script As Specified Userby azatoth (Curate)
|on Jul 04, 2001 at 11:11 UTC||Need Help??|
azatoth has asked for the
wisdom of the Perl Monks concerning the following question:
I was working on a problem yesterday, in which a cleanup script I was running failed to do it's job, due to permissions. It's called from another script, which backs up files into a tarball, then calls the cleanup script to empty the directory, then untars the tarball in the now empty directory. Now I was running this on a development server, so the script was being run as our dev user, but the directories it needed to clean up (remove and make way for the new backup files) were copied over from production by the prod user. Do you see what I'm getting at?
So the script fails, and I need to find out a way to run the script as a certain user, even though it is being called from another script. I *don't* want to create the script as the prod user, and then chmod it u+s, for obvious security reasons. So has anyone ever encountered this type of problem and got a better solution than the dodgy insecure chmod? And yes, the prod user has a password so I can't do system("su - $user '$second_script'");...
Thanks in advance.
Azatoth a.k.a Captain Whiplash
Make Your Die Messages Full of Wisdom!
Get YOUR PerlMonks Stagename here!
Want to speak like a Londoner?