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!

SHARE:
nv-author-image

Stefan Durand

My name is Stefan, I'm the admin of LinuxScrew. I am a full-time Linux/Unix sysadmin, a hobby Python programmer, and a part-time blogger. I post useful guides, tips, and tutorials on common Linux and Programming issues. Feel free to reach out in the comment section.

Leave a Reply

Your email address will not be published. Required fields are marked *