(1)gzexe加密
[root@ECS iclound]# ifconfig >>ip.txt
[root@ECS iclound]# gzexe ip.txt
[root@ECS iclound]# gzexe -d ip.txt //解密
(2)用tar命令對文件進行加密
[root@ECS iclound]# tar -zcf - ip.txt | openssl des3 -salt -k pwd@123 | dd of=ip_en.txt.des3 //加密
[root@ECS iclound]# dd if=ip_en.txt.des3 | openssl des3 -d -k pwd@123 | tar zxf - //解密
(3)用tar結合openss對文件進行加密
[root@ECS iclound]# tar -czf -* | openssl enc -e -aes256 -out ip.txt.tar.gz //加密
[root@ECS iclound]# openssl enc -d -aes256 -in ip.txt.tar.gz | tar xz -C /root/ //解密
(4)用shc加密(僅僅對shell腳本加密)
shc是一個專業的加密shell腳本的工具.它的作用是把shell腳本轉換為一個可執行的二進制文件,這個辦法很好的解決了腳本中含有IP、密碼等不希望公開的問題。
[root@ECS iclound]# cd /usr/local/src/
[root@ECS src]# wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9.tgz
[root@ECS src]# tar -zvxf shc-3.8.9.tgz
[root@ECS shc-3.8.9]# mkdir -p /usr/local/man/man1
[root@ECS shc-3.8.9]# make install
[root@ECS iclound]# shc -r -f 01.sh //生成二進制
[root@ECS iclound]# ls -l
總用量 28
-rw-r--r-x 1 root root 33 12月 17 14:08 01.sh
-rwx--x--x 1 root root 11232 12月 17 14:09 01.sh.x
-rw-r--r-- 1 root root 9467 12月 17 14:09 01.sh.x.c //.x為加密后的二進制
(5)用ZIP加密
[root@ECS iclound]# zip -e ip.txt.zip ip.txt //加密
Enter password:
Verify password:
adding: ip.txt (deflated 71%)
[root@ECS iclound]#
[root@ECS iclound]# unzip ip.txt.zip //解密
Archive: ip.txt.zip
[ip.txt.zip] ip.txt password:
(6)用GnuPG加密
GnuPG全程是GNU隱私保護,通常稱為GPG,通常只能針對文件加密無法對文件夾加密
[root@ECS iclound]# yum -y install gnupg
[root@ECS iclound]# gpg2 -c ip.txt //加密
[root@ECS iclound]# gpg2 ip.txt.gpg //解密