Two ways to encrypt shell scripts under CentOS _linux shell

Source: Internet
Author: User

The first method (Gzexe):

This type of encryption is not a very safe method, but can satisfy the general encryption use, can conceal the password in the script and so on information.
It is the use of the system's own Gzexe program, it is not only encrypted, while compressing the file.
How to use:

Copy Code code as follows:

Gzexe file.sh

It will be the original unencrypted files back to file.sh~, while file.sh is turned into encrypted files;

The second method (SHC):

Use SHC to encrypt Linux shell scripts.
SHC is a professional tool for encrypting shell scripts. Its role is to convert the shell script into an executable binary file, which is a good solution to the script contains IP, password and so do not want to open the issue.

SHC's official website download address:

http://www.datsi.fi.upm.es/~frosal/sources/

Installation:

Copy Code code as follows:

Tar xzvf shc-3.8.6.tgz
CD shc-3.8.6
Mkdir-p/usr/local/man/man1

This step is necessary, otherwise the installation will be an error, SHC will install the command to the/usr/local/bin/directory, the Help document stored in the/usr/local/man/man1/directory, if the system does not have this directory, the installation will error, you can create this directory and then perform the installation
Copy Code code as follows:

Make install

This is to answer yes or Y, you can not return directly, or you will error
How to use:
The "-F" option specifies the program to encrypt
Copy Code code as follows:

Shc-r-F Script-name

Two files will be generated after the run, script-name.x and script-name.x.c. Where script-name.x is an executable binary file that is encrypted, it can be run with./script-name, SCRIPT-NAME.X.C is the original file (C language) that generates script-name.x.

The other SHC also provides a way to set a valid execution time, you can first use SHC to convert the shell program to binary, plus expiration times, such as:

Copy Code code as follows:

# shc-e 18/10/2006-m "It's Too late to run this script"-F SCRIPT.S

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.