LinuxCommandLibrary

shc

Compile shell scripts to binary executables

TLDR

Compile shell script

$ shc -f [script.sh]
copy
Set expiration date
$ shc -e [31/12/2025] -f [script.sh]
copy
Set expiration message
$ shc -m "[Script expired]" -f [script.sh]
copy
Custom output name
$ shc -o [binary] -f [script.sh]
copy
Relaxed security
$ shc -r -f [script.sh]
copy
Verbose output
$ shc -v -f [script.sh]
copy

SYNOPSIS

shc [-f script] [-o output] [-e date] [-m message] [options]

DESCRIPTION

shc converts shell scripts into compiled binary executables by encrypting the script content and wrapping it in auto-generated C code. The resulting C source is compiled with the system's C compiler to produce a standalone binary that decrypts and executes the original script at runtime.
The tool provides basic source code obfuscation rather than true security, since the script can be recovered from the binary with sufficient effort. Optional features include expiration dates that make the binary refuse to run after a specified date, and strict mode that binds the binary to the current host to prevent redistribution. Relaxed mode (-r) allows the binary to run on different systems.
An intermediate .x.c file containing the generated C source is produced alongside the binary and can be inspected, modified, or compiled manually with different options.

PARAMETERS

-f SCRIPT

Input script.
-o FILE
Output binary.
-e DATE
Expiration date.
-m MESSAGE
Expiration message.
-r
Relaxed security.
-v
Verbose.
-T
Allow tracing.
-U
Untraceable mode.

CAVEATS

Not true compilation - script is recoverable. Security is obfuscation, not encryption. Requires C compiler.

HISTORY

shc (Shell Compiler) was created by Francisco Javier Rosales Garcia. It's used for basic shell script protection and distribution.

SEE ALSO

bash(1), gcc(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community