Make linux shell scripts encrypted

One day it came to my mind that bash scripts I was developing for a long time (approximately 5000 lines) should be encrypted in order not to be viewed by everyone…

Thanks to heaven there is utility written by Francisco Javier Rosales García SHC that allows to create a stripped binary executable version of the script.

This utility is included into many Linux distributions’ repositories (I’ve used it in Ubuntu and Fedora). To use it in Ubuntu (my laptop operating system) just install it by commands:

apt-get install shc
apt-get install build-essential

The second command installs dependencies for SHC. On my Ubuntu Feisty they weren’t installed automatically during SHC installation and I’ve got errors when compile scripts with SHC (that’s why I’ve installed them explicitly).

When necessary packages are installed compile some script with command:

shc -f script.sh

This command will create script.sh.x which can be run as a regular binary and is encrypted. Moreover this executable can be started only on the machine it’s compiled at (of course until you’ve compiled it with ‘relax security’ option -r).

This utility is also useful to create demo version binaries: it’s possible to set expiration date for the binary.

Respect to the author!

Advertisements

2 Responses to “Make linux shell scripts encrypted”


  1. 1 Waste September 5, 2008 at 9:02 pm

    Is there an equivalent for expect scripts? Some expect scripts contain passwords etc, so compiling/encrypting while remaining executable would be very handy.

    Any thoughts?

    Waste.


  1. 1 Can’t find a way to encrypt Unix/Linux shell script… « Linux Screw Trackback on August 22, 2007 at 2:56 pm

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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




Archive


%d bloggers like this: