Shc method
Shc is a tool for encrypting shell scripts. It converts shell scripts into executable binary files.
Automated maintenance of the system using shell scripts is simple, convenient, and portable.
However, shell scripts can be read and written, and sensitive information such as user name, password, path, and IP address may be leaked.
Similarly, sensitive information is exposed when shell scripts are run.
Shc is a tool for encrypting shell scripts. It converts shell scripts into executable binary files.
This solves the above problems.
Install shc
Yum-y install shc
If yum cannot be installed, go to official download rpm package http://pkgs.repoforge.org/shc/
Usage:
Shc-r-f script-name Note: The-r option must be available.-f is followed by the script name to be encrypted.
Two files, script-name.x and script-name.x.c, are generated after running
The script-name.x is an encrypted executable binary file.
./Script-name to run.
Script-name.x.c is the original file for generating script-name.x (C)
Gzexe method
This encryption method is not very safe, but can meet the general encryption purpose, can conceal the password and other information in the script.
It uses the built-in gzexe program, which not only encrypts but also compresses files.
Usage:
Gzexe file. sh
It backs up unencrypted files as file. sh ~ At the same time, file. sh is converted into an encrypted file;
After that, we generally use the first shc method. Although the later gzexe method is simple, it is not very safe.