What is the best way to obfuscate a shell script in AIX? The problem is that as a shared user, I would like that others don't know the code.

  • 6
    Convert it to Perl.
    – Marco
    Jul 15 '15 at 16:45
  • But with Perl also see the code no?
    – user650034
    Jul 15 '15 at 16:49
  • 1
    It was meant as a joke because Perl has a reputation of being hard to read. The real answer is “don't do that”! If the code is secret, encrypt it (or at least compile it to a binary which is much harder to reverse engineer than an obfuscated script). If it's not secret, share it.
    – Marco
    Jul 15 '15 at 16:56
  • Thanks Marco...but what application or how to encrypt or compile?
    – user650034
    Jul 15 '15 at 16:57
  • To encrypt you could leverage openssl or gpg for instance. But note that you have to decrypt the script before you run it. If you don't know how to compile, skip that idea. It's insecure anyway.
    – Marco
    Jul 15 '15 at 17:05

Don't try do it. It can't be done. There are programs that are sold as shell obfuscators, but they only obfuscate the script against attackers who aren't going to spend any effort to break it. Obfuscators can, however, break in interesting ways.

If you wanted obfuscation to hide passwords or other sensitive data: that's not possible. The data would be easy to observe at runtime — obfuscated or not, at some point the data has to be deobfuscated in order to be processed. If you need to protect sensitive data, you need an account that you don't share with people you don't trust.

If you wanted obfuscation to hide the logic of your script: don't do it. If your script is valuable enough that somebody will want to find out how it works, an obfuscator won't protect you. If your script isn't that valuable, it's not worth obfuscating.


If you set no read/write permissions then they can't read it. You could still set execute permissions.

  • The first good and usable answer in this thread.
    – ott--
    Jul 23 '15 at 20:51
  • 1
    Does execute-only work for shell scripts on AIX? On several systems, it doesn't; read permission is necessary.
    – dhag
    Jul 23 '15 at 20:53

How big is the aix shell source. If you understand it well, can you replicate your logic in a Python (assume you know Python). If you could do it, then you can use PyInstaller to compile it in binary.

I would not advice C as it may be an overkill.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.