Locking a script

Hello everyone

Im sure this has been asked lots of times before, but after endless searching i cant find what i need.
How can i make a bash script unreadable to all, including root, but still executable, im not worried about editing it again etc... , is there a way to convert it or something, i have tried chmod and chown, but root is still able to view the script, or is not possible.
Thanks in advance for any help.

Dave

This is not possible. Root will always be able to do what it wants. If you work with passwords etc. in there and don't want to have it visible, maybe use md5 encryption with perl or something.

Edit: Or write it in C or Perl and compile it.

Root is your machine's god.

The only thing I can think of is to encrypt your bash file.

Thanks guys,
is it possible to encrypt passwords in the script, i know that when i make a kickstart file, it gives the option to encrypt the password, and its unreadable but still usable, not that im wording this very well, but hopefully you get what i mean.

Thanks
Dave

Have a look at openssl and gnupg

Okay i found one way with rot13
Say your script is called "script.sh". You can "encrypt" it with:

Then put this code at the very start of the encrypted script "skrypt.sh":

...and put these lines at the very end of the "encrypted" script:

This isnt the safest but will deter most, plus you can make it stronger by double encrypting etc...

I am trying to work out another way with md5 which would be better i think!