Shell script Encryption Form

Source: Internet
Author: User

Shell scripts are especially important in the daily operations, and often we write shel scripts that involve a lot of privacy information, including passwords, which requires the shell script to be encrypted and the results to be executed. The following article introduces two ways to encrypt shell scripts:

SHC encryption Method 1, SHC Software Installation

CD/MNT//Enter or create a directory, that is, select the download location
wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9.tgz//download package
Tar zxvf shc-3.8.9.tgz-c/opt//Unpacking Package

Decompression after the completion of the package is not anxious to install, first install the environment-dependent package:

Yum Install gcc gcc-c++ make-y
cd/opt/shc-3.8.9
Make install//perform installation

Note: If the installation times below are incorrect, you will need to create a working directory.

Mkdir-p/usr/local/man/man1//Create software default working directory
Make install//install again

2. Encrypt shell scripts

Cd/opt
Ls-l

-rw-r--r--. 1  root   root    38 6月  22 09:54 123.sh

Shc-r-F 123.sh//SHC Encryption for scripts
Ls-l

-rwx--x--x. 1 root root 11184 6月 22 09:56 123.sh.x  //加密后的可执行的二进制文件-rw-r--r--. 1 root root 9456 6月 22 09:56 123.sh.x.c  //生成123.sh.x的原文件(c语言)

./123.sh.x//Execute encrypted shell script

this is test shell    //依旧可正常输出
Gzexe Encryption method

The Gzexe encryption shell script is the system's own, its function is relatively weaker than SHC, can only meet the general requirements.

Cd/opt
Ls-l

-rw-r--r--. 1  root   root    38 6月  22 09:54 123.sh

Gzexe 123.sh//Encrypt files
Ls-l

-rw-r--r--. 1 root     root       864 6月  22 10:05 123.sh   //加密后文件-rw-r--r--. 1 root     root        38 6月  22 09:54 123.sh~   //原文件备份文件

Note: The system comes with the Gzexe program, it is not only encrypted, while compressing the file, and encrypted, the original file was backed up as a 123.sh~ file.

./123/sh

this is test shell    //依旧可正常输出

Shell script Encryption Form

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.