To run a shell script in an encrypted mode

Scenario:  To encrypt a shell script for security reason and to call the encrypted shell script in another shell script.

Prerequisite for installing shc (encrypting a shell script):
Gcc library is required before installing shc application.

SHC installation in Centos:

Step1:  #yum install gcc

Step2: #yum install shc ( it will install shc.x86_64) based on the OS version.
Now steps to encrypt a shell script.

After the successful installation of SHC the following steps to be carried out.

Step3: create a shell script to display your login-id and the computer hostname.
Echo –n “I am logged on as”; whoami
Echo –n “ My computer name”; hostname
Save the file and close (:wq) - File name

Step4:  now run the command
#shc –f
This will create two files a. b.

Step5:  Run the command to execute in another shell script
# shc –v  –r  -T –f

Step 6: Create another script to call the encrypted script.
echo Calling sh

Step7:  Execute another script and check with the original one; both output must be similar.


One Response to To run a shell script in an encrypted mode

  1. tshrinivasan says:

    Good find.

    Thanks for sharing.

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 )

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

%d bloggers like this: