Shell script to Binary executable file Conversion

If you wise to distribute your script but don’t want anyone to modification or inspection, follow the below procedure to protect the script by converting to binary executable format.

  1. Write a shell script. eg.
  2. If your system runs on RHEL5, Download & Install “shc” rpm from  For other version of OS, download & install the appropriate rpm version
  1. Execute the following commandshc –v –e 20/03/2011 –m “Command expired” –r  –T  –f  <>
    • v Verbose compilation
    • -r Relax security. Make a redistributable binary which executes on different systems running the same operating system.
    • -T Allow binary to be traceable (using strace, ptrace, truss, etc.)
    • -f <script name> File name of the script to compile
    • -e <dd/mm/yyyy> Expiration date in dd/mm/yyyy format
    • -m <message> message to display upon expiration

  1. Upon the compilation, you will get output similar to this

                    shc shll=bash
                    shc [-i]=-c
                    shc [-x]=exec ‘%s’ “$@”
                    shc [-l]=
                    shc opts=
                    shc: cc -o
                    shc: strip
                    shc: chmod go-r

  1. Verify the file type


           ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

  1. Now you can execute the command & check the result


  1. Backup your original script and distribute the executable file.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s