Reputation: 795
I Have a shell script. I've to make it available for all the users for EXECUTION only. And i've to hide/protect the content in it. So, nobody will not copy that file. Is there anyway to do like password protection for read or encrypting the script ? Please suggest me.
Upvotes: 1
Views: 5063
Reputation: 263307
Make the script readable only by some specified account, and provide an executable, setuid
to that account, that runs the script.
Of course that means the script will run with the specified account's privileges rather than the user's privileges.
Upvotes: 1
Reputation: 3090
Mostly scripts are not intended to be hidden. May be you should implement your secret algorithm in some programming language and then and execute that algorithm from script. You would also not need password since executables are binary files and are not human readable.
You just need to know what goes into the program and what goes in the script.
Upvotes: 2
Reputation: 3710
It`s not best practice (why you have such requirement ?!) but you can use SHC - shell script compiler.
SHC link : http://www.datsi.fi.upm.es/~frosal/
Upvotes: 0