Link to home
Start Free TrialLog in
Avatar of sganta
sganta

asked on

How to encrypt/decrypt text files in Unix

Hi Experts,

I have set of text files which needs to be encrypted and decrypted.

Pls. let me know if any unix/shell commands exists to encrypt text files.

Thanks in advance
Ganta
ASKER CERTIFIED SOLUTION
Avatar of stefan73
stefan73
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sganta
sganta

ASKER

Hi Stefan and Tintin,

Thanks for your valuable inputs. We have software files Shell scripts. Would like to encrypt and decrypt
the shell scripts while using at Customer Site.

Regards
Ganta
What exactly do you mean that you want to encrypt/decrypt shell scripts?  What are you trying to achieve?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I second ahoffmann.

The problem is that you need to decode your files somewhere. This will have to happen in the scripts; any nosey Unix user will be able to do that, too.

Another problem is that scripts require read rights to be executed. Setting the 'x' bit without the 'r' bit won't work, this only works for binaries.

The only way to use encoded scripts is to embed them in a binary framework which will handle all the decryption and execute them as a call to exec(). Technically speaking, those won't be scripts anymore and you'll lose the ease in maintaining them.

You could check if the shell supports reading scripts from a FIFO; this would enable you to write the decoded script by your binary, while the shell is reading it. This won't leave decoded script snippets somewhere on the drive.
>  This won't leave decoded script snippets somewhere on the drive.
.. but in memory ;-)
yes, there's no 100% security - the wrapper binary would have to go a long way to keep out curious eyes...