Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make a Perl script executable from everywhere by everyone?

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?

like image 924
aidan Avatar asked Jan 24 '23 14:01

aidan


2 Answers

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.

like image 155
Matthew Flaschen Avatar answered Jan 29 '23 20:01

Matthew Flaschen


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

like image 34
converter42 Avatar answered Jan 29 '23 22:01

converter42