I can't get mcrypt to work on a FreeBSD server ([Bus error 10]). GPG doesn't work, it says it cannot open /dev/tty.

Any ideas?

Also, I kind need to be able to decrypt the file on (Ubuntu) Linux. I tried enigma/crypt on FreeBSD, and then when I copy the file to Linux, crypt cannot decrypt it.

  • 1
    Regarding gpg, do you use gpg in a script or from a GUI? There is a "--no-tty" option that might help
    – arved
    Dec 9, 2011 at 12:49

1 Answer 1


For symmetric encryption you could use enc(1) which is part of openssl. To encrypt a file with aes256-xts cipher:

openssl enc -aes-256-xts -in foo.txt -out foo.txt.enc

And to decrypt it:

openssl enc -d -aes-256-xts -in foo.txt.enc -out foo.txt

Pretty easy huh?

One other neat feature is that it supports base64 which means it'll use only ascii characters. Just add -a to the list of arguments and then look at the encrypted file.

enc(1) is a versatile program. I use it often when I quickly want to copy a file or a small compressed tar archive from one terminal screen to the other, I simply only use base64.

Let's say I want to quickly copy a directory /home/drumfire/test which contains a few files, and can't use scp or other tools. It's trivial to run this through a compression program and encode it:

tar cf - /home/drumfire/test | xz -9ec | openssl enc -a

The result is a blob of ascii text. I select to copy it, and then on the target system I can simply do:

openssl enc -a -d | xz -dc | tar xvf -

In this case Openssl will wait for input from stdin. so I hit Shift+Insert which pastes the text, then I press press CTRL+D two times and voila, it extracts.

Neat stuff. B-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .