dm90
dm90

Reputation: 795

How to protect shell script's code

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

Answers (3)

Keith Thompson
Keith Thompson

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

Kaunteya
Kaunteya

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

Martin V.
Martin V.

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

Related Questions