views:

837

answers:

2

I wrote a very simple perl script, and now I want to make it executable from everywhere.

I know I could just drop it into /bin/, rename it from 'mytest.pl' -> 'mytest', and chmod +x, but is this standard practice? I noticed nothing in /bin/ is a perl script.

Also, I want it to be able to log to /var/logs/mytest/*

Are there any security issues I should be aware of?

+3  A: 

It is preferable to put user-made scripts in /usr/local/bin , but it's your call whether it's worth worrying about this. As far as logging to /var/logs/mytest/*, you can try to make the script suid (this is sometimes not allowed for security) with a user that can write to the dir, or just make /var/logs/mytest world-writable.

Matthew Flaschen
Thanks Matt, I found a whole bunch of perl scripts in there and I'm now following their lead.
aidan
Some systems may need the `perlsuid` executable in order to run a Perl script with setuid privileges. `perlsuid` might not be installed by default (Debian splits it out into its own extra package (http://packages.debian.org/perl-suid) which isn't depended on) and has been deprecated in favor of using other mechanisms like `sudo`.
ephemient
+2  A: 

Instead of worrying about log file permissions issues, why not log to the system logger? That's what it's there for. See Sys::Syslog

converter42