Never Ending Security

It starts all here

How To Hide Your Bash Script Codes


Hide Your Bash Script Code

I was looking for a way to hide my bash script’s code. Whatever i coded i wanted it to be a secret,so that it could not be edited and should be confusing at least. So here’s a tutorial on how to do that.

Suppose your script is just a simple one saying hi saved as

 echo hi

Now anyone can open it with a text editor like vi, leafpad and copy stuff , steal code and do other things.

To avoid that just download shc from here

Once u downloaded the archive ; extract it, cd to the directory and compile it by typing “make” as usual, ie.

 # tar xvfz shc-3.8.9.tgz
 # cd shc-3.8.9
 # make

Verify that it is installed by typing

 #./shc -v

Now in the same directory create and save your shell script.

Assuming the script u saved is named “”

Now to encrypt type

 #./shc -f

This will create two additional files named is the C source code of the file. AND is the encrypted shell script in binary format.

The c source file i.e. is actually compiled to form

You can run the file as


Also u can rename it to whatever u want and run as per its name.

Anoter cool feature u shc provides is to set an expiration date. Means no one will be able to run your script after the time you have specified. U can use it with -e option

./shc -e 20/10/2014 -f

Will stop anyone from executing the script after 20/10/2014 and will throw this error

$ ./
./ has expired!
Please contact your provider

To alter the default message use the -m option

./shc -f -e 20/10/2014 -m "TIME_OVER"

Other Options include::

  • -r – will relax security to create a redistributable binary that executes on other systems that runs the same operating system as the one on which it was compiled.
  • -T – will allow the created binary files to be traceable using programs like strace, ltrace, etc.
  • -v  – is for verbose


Sometimes u might encounter the error “Operation Not Permitted” on executing the script. To overcome that run the script as root.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s