How to configure SHC Encoder in Linux server

SHC is a program that can be used to add an extra layer of security to those shell scripts. SHC will encrypt shell scripts using RC4 and make an executable binary out of the shell script and run it as a normal shell script. This utility is great for programs that require a password to either encrypt, decrypt, or require a password that can be passed to a command line argument.

This article explains the details steps to install and configure SHC in Linux server.

1. Download shc and install it

Download shc and install it as shown below.

# wget
# tar xvfz shc-3.8.7.tgz
# cd shc-3.8.7
# make

2. Verify that shc is installed properly.

$ ./shc -v
shc parse(-f): No source file specified

shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script

3. Encrypt the Shell Script Using shc

Encrypt the shell scripting using shc as shown below.

$ ./shc -f

This will create the following two files:

$ ls -l*
-rwxrw-r--. 1 ramesh ramesh 149 Mar 27 01:09
-rwx-wx--x. 1 ramesh ramesh 11752 Mar 27 01:12
-rw-rw-r--. 1 ramesh ramesh 10174 Mar 27 01:12 is the original unencrypted shell script is the encrypted shell script in binary format is the C source code of the file.

This C source code is compiled to create the above encrypted file. The whole logic behind the shc is to convert the shell script to C program (and of course compile that to generate the executable)

$ file Bourne-Again shell script text executable

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

$ file ASCII C program text

4. Execute the Encrypted Shell Script

Now, let us execute the encrypted shell script to make sure it works as expected.

$ ./

How many random numbers do you want to generate? 3

Leave a Reply

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