Reputation: 25
How can I lock my Perl script, list I have to do
Prevent Others from read or write Perl Script.
They should have only Permission to Executing the Perl script.
Upvotes: 0
Views: 132
Reputation: 612
755 is the *nix permission you'll need. This will give the owner full access and other read and execute.
As other has said, there is no way to make your code unreadable. However,can you obfuscate you code so only a reasonably good programmer could decode it. There are online tools, if you search "perl obfuscate" on bing you'll get some good results; these tools will mean no module is required. Or my personal favorite is the module Acme::Bleach.
Upvotes: 0
Reputation: 525
If the system at hand is Linux/Unix and you have administrative access then you can use sudo
.
With the following line in /etc/sudoers
, anyone would be able to run, as author1, any executable file in the public_bin
folder:
ALL ALL = (author1) /home/author1/public_bin/*
However, take a look at man sudoers
to understand implications wrt. environment and command line arguments.
Upvotes: 1
Reputation: 944011
This depends on your operating system, which you haven't specified.
Typically, this is not possible.
On a UNIX based system (such as Linux or Mac OS) there are three permissions that can be given to users, groups and everyone: Read, Write, and Execute.
You can remove Write permission easily enough, but Read permission is required to allow the script to be executed.
(I assume you would experience a similar problem on Windows).
The only work around I can think of would be to rewrite the script as a webservice. Then the HTTP server would need to be able to read it, but the users themselves would not.
Upvotes: 2