Linux – How to Crypt an sh script into Linux Environnement

encryptionlinuxscripting

I've a tinny question, how can I crypt my scripts?
I mean, for exemple, sometimes I've some sh scripts (provided by some company like VMWare) and when I VI's it they just show me a crypted file and not a plained text file.

How Can I transform my plained text scripts into an crypted script?

Best Answer

This site seems to have a script that will do what you want:

http://megastep.org/makeself/

From the site:

makeself.sh is a small shell script that generates a self-extractable tar.gz archive from a directory. The resulting file appears as a shell script (many of those have a .run suffix), and can be launched as is. The archive will then uncompress itself to a temporary directory and an optional arbitrary command will be executed (for example an installation script). This is pretty similar to archives generated with WinZip Self-Extractor in the Windows world. Makeself archives also include checksums for integrity self-validation (CRC and/or MD5 checksums).

See the comment about v2.1.5 supporting encryption through gpg.

I think it's called a shell archive, the original being written by James Gosling (inventor of Java).

http://blogs.oracle.com/jag/entry/shar_a_blast_from_the