Interactive Shell Script: Command Line File EncryptionShare
In today’s installment of Terminal Thursday we’ll be encrypting a single file from the command line courtesy of an excellent tip from the guys over at OSXDaily. The openssl utility ships with your Mac – and it’s pretty easy to use.
An OSXDaily reader posted a comment asking if there was a drag and drop way to encrypt a file. We’ve got a solution – sort of. Murphy sees this as a perfect place to introduce a shell script that prompts the user for input. Just kick off the shell script and you’re prompted for the file you want to encode. You can drag the file onto your Terminal window and hit enter. You’ll be prompted to set a password and you’re done.
You could make a similar shell script for decrypting the files too. And you’re not stuck with Murphy’s method, which dumps the output in a pre-configured folder. You could concatenate an extension onto the encrypted filename instead. Whatever works for you.
The screencast assumes you’ve seen Murphy’s post about making a shell script, so you might want to check that one out before getting started. It also introduces basename – which helps us extract a file name from a full path.
A word of warning from the original post: Don’t forget your password. Chances are you’re not going to find a way to break triple-des security.
UPDATE: Carry out this process with a Widget.Watch Now | Permalink